diff options
Diffstat (limited to 'libc/inet/ntop.c')
-rw-r--r-- | libc/inet/ntop.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c index 6f3a8ccec..88ff6a150 100644 --- a/libc/inet/ntop.c +++ b/libc/inet/ntop.c @@ -30,6 +30,13 @@ #include <string.h> #include <ctype.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(strchr) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(sprintf) +libc_hidden_proto(tolower) /* * WARNING: Don't even consider trying to compile this on a system where @@ -76,12 +83,12 @@ inet_ntop4(const u_char *src, char *dst, size_t size) } tmp[i - 1] = '\0'; - if (__strlen (tmp) > size) { + if (strlen (tmp) > size) { __set_errno (ENOSPC); return (NULL); } - return __strcpy(dst, tmp); + return strcpy(dst, tmp); } @@ -114,7 +121,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) * Copy the input (bytewise) array into a wordwise array. * Find the longest run of 0x00's in src[] for :: shorthanding. */ - __memset(words, '\0', sizeof words); + memset(words, '\0', sizeof words); for (i = 0; i < 16; i += 2) words[i / 2] = (src[i] << 8) | src[i + 1]; best.base = -1; @@ -160,10 +167,10 @@ inet_ntop6(const u_char *src, char *dst, size_t size) (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) return (NULL); - tp += __strlen(tp); + tp += strlen(tp); break; } - tp += __sprintf(tp, "%x", words[i]); + tp += sprintf(tp, "%x", words[i]); } /* Was it a trailing run of 0x00's? */ if (best.base != -1 && (best.base + best.len) == 8) @@ -177,7 +184,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) __set_errno (ENOSPC); return (NULL); } - return __strcpy(dst, tmp); + return strcpy(dst, tmp); } #endif /* __UCLIBC_HAS_IPV6__ */ @@ -224,7 +231,7 @@ inet_pton4(const char *src, u_char *dst) } if (octets < 4) return (0); - __memcpy(dst, tmp, 4); + memcpy(dst, tmp, 4); return (1); } @@ -249,7 +256,7 @@ inet_pton4(const char *src, u_char *dst) * So undef it here so we get the function version of tolower * instead. */ -#undef __tolower +#undef tolower static int inet_pton6(const char *src, u_char *dst) @@ -261,7 +268,7 @@ inet_pton6(const char *src, u_char *dst) u_int val; - tp = __memset(tmp, '\0', 16); + tp = memset(tmp, '\0', 16); endp = tp + 16; colonp = NULL; /* Leading :: requires some special handling. */ @@ -271,10 +278,10 @@ inet_pton6(const char *src, u_char *dst) curtok = src; saw_xdigit = 0; val = 0; - while ((ch = __tolower (*src++)) != '\0') { + while ((ch = tolower (*src++)) != '\0') { const char *pch; - pch = __strchr(xdigits, ch); + pch = strchr(xdigits, ch); if (pch != NULL) { val <<= 4; val |= (pch - xdigits); @@ -333,7 +340,7 @@ inet_pton6(const char *src, u_char *dst) } if (tp != endp) return (0); - __memcpy(dst, tmp, 16); + memcpy(dst, tmp, 16); return (1); } @@ -349,8 +356,9 @@ inet_pton6(const char *src, u_char *dst) * author: * Paul Vixie, 1996. */ -const char attribute_hidden * -__inet_ntop(int af, const void *src, char *dst, socklen_t size) +libc_hidden_proto(inet_ntop) +const char * +inet_ntop(int af, const void *src, char *dst, socklen_t size) { switch (af) { case AF_INET: @@ -365,7 +373,7 @@ __inet_ntop(int af, const void *src, char *dst, socklen_t size) } /* NOTREACHED */ } -strong_alias(__inet_ntop,inet_ntop) +libc_hidden_def(inet_ntop) /* int @@ -379,8 +387,9 @@ strong_alias(__inet_ntop,inet_ntop) * author: * Paul Vixie, 1996. */ -int attribute_hidden -__inet_pton(int af, const char *src, void *dst) +libc_hidden_proto(inet_pton) +int +inet_pton(int af, const char *src, void *dst) { switch (af) { case AF_INET: @@ -395,4 +404,4 @@ __inet_pton(int af, const char *src, void *dst) } /* NOTREACHED */ } -strong_alias(__inet_pton,inet_pton) +libc_hidden_def(inet_pton) |