From c37f4b6ac329ab4ef8a2c85f5dfebc4218ce017a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 11 May 2025 23:48:10 +0200 Subject: [PATCH] inet_ntop: rename curlx_inet_ntop to Curl_inet_ntop It is not part of the curlx club. Closes #17313 --- lib/connect.c | 8 +++----- lib/ftp.c | 4 ++-- lib/hostip.c | 4 ++-- lib/if2ip.c | 4 ++-- lib/inet_ntop.c | 2 +- lib/inet_ntop.h | 12 ++++++------ lib/urlapi.c | 2 +- 7 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index 52f2c84a4e..2ae87bc0c1 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -255,7 +255,7 @@ addr_next_match(const struct Curl_addrinfo *addr, int family) } /* retrieves ip address and port from a sockaddr structure. - note it calls curlx_inet_ntop which sets errno on fail, not SOCKERRNO. */ + note it calls Curl_inet_ntop which sets errno on fail, not SOCKERRNO. */ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, char *addr, int *port) { @@ -272,8 +272,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, switch(sa->sa_family) { case AF_INET: si = (struct sockaddr_in *)(void *) sa; - if(curlx_inet_ntop(sa->sa_family, &si->sin_addr, - addr, MAX_IPADR_LEN)) { + if(Curl_inet_ntop(sa->sa_family, &si->sin_addr, addr, MAX_IPADR_LEN)) { unsigned short us_port = ntohs(si->sin_port); *port = us_port; return TRUE; @@ -282,8 +281,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, #ifdef USE_IPV6 case AF_INET6: si6 = (struct sockaddr_in6 *)(void *) sa; - if(curlx_inet_ntop(sa->sa_family, &si6->sin6_addr, - addr, MAX_IPADR_LEN)) { + if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr, addr, MAX_IPADR_LEN)) { unsigned short us_port = ntohs(si6->sin6_port); *port = us_port; return TRUE; diff --git a/lib/ftp.c b/lib/ftp.c index 8804ce5e61..b47406f8c2 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1020,11 +1020,11 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, switch(sa->sa_family) { #ifdef USE_IPV6 case AF_INET6: - r = curlx_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); + r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); break; #endif default: - r = curlx_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf)); + r = Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf)); break; } if(!r) { diff --git a/lib/hostip.c b/lib/hostip.c index 266ba8e549..6cb695f3c4 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -145,14 +145,14 @@ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, case AF_INET: { const struct sockaddr_in *sa4 = (const void *)ai->ai_addr; const struct in_addr *ipaddr4 = &sa4->sin_addr; - (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize); + (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize); break; } #ifdef USE_IPV6 case AF_INET6: { const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr; const struct in6_addr *ipaddr6 = &sa6->sin6_addr; - (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize); + (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize); break; } #endif diff --git a/lib/if2ip.c b/lib/if2ip.c index a8acd1f2e4..6da68efd50 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -162,7 +162,7 @@ if2ip_result_t Curl_if2ip(int af, addr = &((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr; res = IF2IP_FOUND; - ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr)); + ip = Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr)); msnprintf(buf, buf_size, "%s%s", ip, scope); break; } @@ -235,7 +235,7 @@ if2ip_result_t Curl_if2ip(int af, s = (struct sockaddr_in *)(void *)&req.ifr_addr; memcpy(&in, &s->sin_addr, sizeof(in)); - r = curlx_inet_ntop(s->sin_family, &in, buf, buf_size); + r = Curl_inet_ntop(s->sin_family, &in, buf, buf_size); sclose(dummy); if(!r) diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index 26d84a907b..a1a34891c0 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -196,7 +196,7 @@ static char *inet_ntop6(const unsigned char *src, char *dst, size_t size) * code. This is to avoid losing the actual last Winsock error. When this * function returns NULL, check errno not SOCKERRNO. */ -char *curlx_inet_ntop(int af, const void *src, char *buf, size_t size) +char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size) { switch(af) { case AF_INET: diff --git a/lib/inet_ntop.h b/lib/inet_ntop.h index 97d5adedb5..9923daaed1 100644 --- a/lib/inet_ntop.h +++ b/lib/inet_ntop.h @@ -26,7 +26,7 @@ #include "curl_setup.h" -char *curlx_inet_ntop(int af, const void *addr, char *buf, size_t size); +char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size); #ifdef HAVE_INET_NTOP #ifdef HAVE_NETINET_IN_H @@ -39,12 +39,12 @@ char *curlx_inet_ntop(int af, const void *addr, char *buf, size_t size); #include #endif #ifdef __AMIGA__ -#define curlx_inet_ntop(af,addr,buf,size) \ - (char *)inet_ntop(af, CURL_UNCONST(addr), (unsigned char *)buf, \ - (curl_socklen_t)(size)) +#define Curl_inet_ntop(af,addr,buf,size) \ + (char *)inet_ntop(af, CURL_UNCONST(addr), (unsigned char *)buf, \ + (curl_socklen_t)(size)) #else -#define curlx_inet_ntop(af,addr,buf,size) \ - inet_ntop(af, addr, buf, (curl_socklen_t)(size)) +#define Curl_inet_ntop(af,addr,buf,size) \ + inet_ntop(af, addr, buf, (curl_socklen_t)(size)) #endif #endif diff --git a/lib/urlapi.c b/lib/urlapi.c index f2196a8062..8cf174ff23 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -513,7 +513,7 @@ static CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname, hostname[hlen] = 0; /* end the address there */ if(1 != curlx_inet_pton(AF_INET6, hostname, dest)) return CURLUE_BAD_IPV6; - if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen)) { + if(Curl_inet_ntop(AF_INET6, dest, hostname, hlen)) { hlen = strlen(hostname); /* might be shorter now */ hostname[hlen + 1] = 0; } -- 2.47.3