-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove HAVE_INET_PTON #13410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove HAVE_INET_PTON #13410
Conversation
fe53851
to
e7e7a25
Compare
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:
|
@petk Thanks for review. Tests adjusted |
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. |
No problem to me. I will cover it in the next PR. 🙂 |
There was a problem hiding this comment.
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
ext/standard/dns.c
Outdated
@@ -157,7 +157,7 @@ PHP_FUNCTION(gethostbyaddr) | |||
hostname = php_gethostbyaddr(addr); | |||
|
|||
if (hostname == NULL) { | |||
#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON) | |||
#if defined(HAVE_IPV6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if defined(HAVE_IPV6) | |
#ifdef HAVE_IPV6 |
ext/standard/dns.c
Outdated
@@ -172,7 +172,7 @@ PHP_FUNCTION(gethostbyaddr) | |||
/* {{{ php_gethostbyaddr */ | |||
static zend_string *php_gethostbyaddr(char *ip) | |||
{ | |||
#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON) | |||
#if defined(HAVE_IPV6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if defined(HAVE_IPV6) | |
#ifdef HAVE_IPV6 |
if(PHP_INT_SIZE != 4) { die('skip 32 bit only'); } | ||
if(strtolower(substr(PHP_OS, 0, 3)) == 'aix') { die('skip not for AIX'); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: space after if
main/network.c
Outdated
@@ -545,7 +541,7 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo | |||
|
|||
/* first, try interpreting the address as a numeric address */ | |||
|
|||
#if HAVE_IPV6 && HAVE_INET_PTON | |||
#if HAVE_IPV6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if HAVE_IPV6 | |
#ifdef HAVE_IPV6 |
think it should always test definition
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
main/network.c
Outdated
@@ -852,25 +844,21 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short | |||
union { | |||
struct sockaddr common; | |||
struct sockaddr_in in4; | |||
#if HAVE_IPV6 && HAVE_INET_PTON | |||
#if HAVE_IPV6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if HAVE_IPV6 | |
#ifdef HAVE_IPV6 |
main/network.c
Outdated
local_address_len = sizeof(struct sockaddr_in); | ||
local_address.in4.sin_family = sa->sa_family; | ||
local_address.in4.sin_port = htons(bindport); | ||
memset(&(local_address.in4.sin_zero), 0, sizeof(local_address.in4.sin_zero)); | ||
} | ||
} | ||
#if HAVE_IPV6 && HAVE_INET_PTON | ||
#if HAVE_IPV6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if HAVE_IPV6 | |
#ifdef HAVE_IPV6 |
ext/openssl/xp_ssl.c
Outdated
@@ -130,7 +130,7 @@ | |||
#define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out) \ | |||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if defined(HAVE_IPV6) | |
#ifdef HAVE_IPV6 |
main/network.c
Outdated
@@ -545,7 +541,7 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo | |||
|
|||
/* first, try interpreting the address as a numeric address */ | |||
|
|||
#if HAVE_IPV6 && HAVE_INET_PTON | |||
#if HAVE_IPV6 |
There was a problem hiding this comment.
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.
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. |
Analogical change to #12700
When
inet_ntop
is available theninet_pton
also.