diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-09-28 07:46:39 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-09-28 07:46:39 +0000 |
commit | 4d13b2cc64f3782430cccc9da129767d86a33dda (patch) | |
tree | 266b6476d47c6bdeb3a837bbba8ed0e96e766950 /lib/hostip.c | |
parent | 48dc74aeccab16febc770ccc5fec7ec96af26a97 (diff) |
more ipv6 cleanups to make smaller functions that are easier to read
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. */ |