diff options
Diffstat (limited to 'lib/hostip.c')
-rw-r--r-- | lib/hostip.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/hostip.c b/lib/hostip.c index 557a7b921..7177554af 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -68,27 +68,6 @@ /* --- resolve name or IP-number --- */ -static char *MakeIP(unsigned long num,char *addr, int addr_len) -{ -#if defined(HAVE_INET_NTOA) || defined(HAVE_INET_NTOA_R) - struct in_addr in; - in.s_addr = htonl(num); - -#if defined(HAVE_INET_NTOA_R) - inet_ntoa_r(in,addr,addr_len); -#else - strncpy(addr,inet_ntoa(in),addr_len); -#endif -#else - unsigned char *paddr; - - num = htonl(num); /* htonl() added to avoid endian probs */ - paddr = (unsigned char *)# - sprintf(addr, "%u.%u.%u.%u", paddr[0], paddr[1], paddr[2], paddr[3]); -#endif - return (addr); -} - #ifdef ENABLE_IPV6 Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data, char *hostname, @@ -115,6 +94,27 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data, } #else /* following code is IPv4-only */ +static char *MakeIP(unsigned long num,char *addr, int addr_len) +{ +#if defined(HAVE_INET_NTOA) || defined(HAVE_INET_NTOA_R) + struct in_addr in; + in.s_addr = htonl(num); + +#if defined(HAVE_INET_NTOA_R) + inet_ntoa_r(in,addr,addr_len); +#else + strncpy(addr,inet_ntoa(in),addr_len); +#endif +#else + unsigned char *paddr; + + num = htonl(num); /* htonl() added to avoid endian probs */ + paddr = (unsigned char *)# + sprintf(addr, "%u.%u.%u.%u", paddr[0], paddr[1], paddr[2], paddr[3]); +#endif + return (addr); +} + /* The original code to this function was once stolen from the Dancer source code, written by Bjorn Reese, it has since been patched and modified considerably. */ |