Skip to content

Remove HAVE_INET_PTON - #13410

Merged
Girgias merged 11 commits into
php:masterfrom
jorgsowa:remove_HAVE_INET_PTON
Feb 21, 2024
Merged

Girgias merged 11 commits into
php:masterfrom
jorgsowa:remove_HAVE_INET_PTON

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

Analogical change to #12700

When inet_ntop is available then inet_pton also.

@jorgsowa
jorgsowa force-pushed the remove_HAVE_INET_PTON branch from fe53851 to e7e7a25 Compare February 16, 2024 20:31
Comment thread configure.ac Outdated
@petk

petk commented Feb 16, 2024

Copy link
Copy Markdown
Member

Thanks @jorgsowa, I think this is logical indeed, if inet_pton is universally available on the current systems. Then probably also these tests can be simplified in the SKIPIF sections:

  • ext/standard/tests/network/inet.phpt
  • ext/standard/tests/network/inet_ipv6.phpt

@jorgsowa

Copy link
Copy Markdown
Contributor Author

@petk Thanks for review. Tests adjusted

@petk

petk commented Feb 17, 2024

Copy link
Copy Markdown
Member

Perfect, thanks. I'm not sure if this would be too much for this PR, but probably also the inet_aton can be now completely made obsolete and can be removed together with the Windows implementation file(s). The inet_aton is deprecated anyway. If I'm not mistaken...

@devnexen

Copy link
Copy Markdown
Member

Perfect, thanks. I'm not sure if this would be too much for this PR, but probably also the inet_aton can be now completely made obsolete and can be removed together with the Windows implementation file(s). The inet_aton is deprecated anyway. If I'm not mistaken...

I m not objecting neither. If the OP does not want to go any further, it looks good already.

@jorgsowa

Copy link
Copy Markdown
Contributor Author

I'm not sure if this would be too much for this PR, but probably also the inet_aton can be now completely made obsolete and can be removed together with the Windows implementation file(s). The inet_aton is deprecated anyway. If I'm not mistaken...

No problem to me. I will cover it in the next PR. 🙂

@bukka bukka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just minor NITs

Comment thread ext/standard/dns.c Outdated

if (hostname == NULL) {
#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
#if defined(HAVE_IPV6)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(HAVE_IPV6)
#ifdef HAVE_IPV6

Comment thread ext/standard/dns.c Outdated
static zend_string *php_gethostbyaddr(char *ip)
{
#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
#if defined(HAVE_IPV6)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(HAVE_IPV6)
#ifdef HAVE_IPV6

Comment on lines +5 to +6
if(PHP_INT_SIZE != 4) { die('skip 32 bit only'); }
if(strtolower(substr(PHP_OS, 0, 3)) == 'aix') { die('skip not for AIX'); }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: space after if

Comment thread main/network.c Outdated
/* first, try interpreting the address as a numeric address */

#if HAVE_IPV6 && HAVE_INET_PTON
#if HAVE_IPV6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if HAVE_IPV6
#ifdef HAVE_IPV6

think it should always test definition

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I have a long-standing (very outdated PR (#5526) now) to try to enable -Wundef to check these sorts of issues at compile time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need help with this PR, @Girgias ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can take it over, I was hitting some issue with YACC generating something that I couldn't check.

Comment thread main/network.c Outdated
struct sockaddr common;
struct sockaddr_in in4;
#if HAVE_IPV6 && HAVE_INET_PTON
#if HAVE_IPV6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if HAVE_IPV6
#ifdef HAVE_IPV6

Comment thread main/network.c Outdated
}
}
#if HAVE_IPV6 && HAVE_INET_PTON
#if HAVE_IPV6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if HAVE_IPV6
#ifdef HAVE_IPV6

Comment thread ext/openssl/xp_ssl.c Outdated
ASN1_STRING_to_UTF8(&out, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(ne, i)))

#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
#if defined(HAVE_IPV6)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(HAVE_IPV6)
#ifdef HAVE_IPV6

Comment thread main/network.c Outdated
/* first, try interpreting the address as a numeric address */

#if HAVE_IPV6 && HAVE_INET_PTON
#if HAVE_IPV6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I have a long-standing (very outdated PR (#5526) now) to try to enable -Wundef to check these sorts of issues at compile time.

@jorgsowa

Copy link
Copy Markdown
Contributor Author

Thank you all for the reviews. If I should add something else then please let me know. Otherwise, I don't know who should I ask for approval and merge now.

@Girgias
Girgias merged commit e630aac into php:master Feb 21, 2024
@jorgsowa
jorgsowa deleted the remove_HAVE_INET_PTON branch August 7, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants