OSDN Git Service

- trim any trailing whitespace
[uclinux-h8/uClibc.git] / libc / inet / ntop.c
index 2fcc775..f19556d 100644 (file)
 #include <string.h>
 #include <ctype.h>
 
+/* Experimentally off - libc_hidden_proto(memcpy) */
+/* Experimentally off - libc_hidden_proto(memset) */
+/* Experimentally off - libc_hidden_proto(strchr) */
+/* Experimentally off - libc_hidden_proto(strcpy) */
+/* Experimentally off - 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,11 +121,13 @@ 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;
        cur.base = -1;
+       best.len = best.len; /* shutting up compiler warning */
+       cur.len = cur.len;   /* shutting up compiler warning */
        for (i = 0; i < 8; i++) {
                if (words[i] == 0) {
                        if (cur.base == -1)
@@ -160,7 +169,7 @@ 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]);
@@ -177,7 +186,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 +233,7 @@ inet_pton4(const char *src, u_char *dst)
        }
        if (octets < 4)
                return (0);
-       __memcpy(dst, tmp, 4);
+       memcpy(dst, tmp, 4);
        return (1);
 }
 
@@ -245,8 +254,8 @@ inet_pton4(const char *src, u_char *dst)
 #ifdef __UCLIBC_HAS_IPV6__
 
 /* We cannot use the macro version of tolower() or very bad
- * things happen when '*src++' gets evaluated multiple times.  
- * So undef it here so we get the function version of tolower
+ * things happen when '*src++' gets evaluated multiple times.
+ * So undef it here so we get the function version of tolower
  * instead.
  */
 #undef tolower
@@ -261,7 +270,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. */
@@ -274,7 +283,7 @@ inet_pton6(const char *src, u_char *dst)
        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 +342,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 +358,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 +375,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 +389,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 +406,4 @@ __inet_pton(int af, const char *src, void *dst)
        }
        /* NOTREACHED */
 }
-strong_alias(__inet_pton,inet_pton)
+libc_hidden_def(inet_pton)