]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/core/utils.c
Merge tag 'v2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / net / core / utils.c
index f41854470539855adee387a4c488f4be66a017a2..5fea0ab2190274faf53705ee6bb87338072a26cc 100644 (file)
@@ -75,7 +75,7 @@ __be32 in_aton(const char *str)
                                str++;
                }
        }
-       return(htonl(l));
+       return htonl(l);
 }
 EXPORT_SYMBOL(in_aton);
 
@@ -92,18 +92,19 @@ EXPORT_SYMBOL(in_aton);
 
 static inline int xdigit2bin(char c, int delim)
 {
+       int val;
+
        if (c == delim || c == '\0')
                return IN6PTON_DELIM;
        if (c == ':')
                return IN6PTON_COLON_MASK;
        if (c == '.')
                return IN6PTON_DOT;
-       if (c >= '0' && c <= '9')
-               return (IN6PTON_XDIGIT | IN6PTON_DIGIT| (c - '0'));
-       if (c >= 'a' && c <= 'f')
-               return (IN6PTON_XDIGIT | (c - 'a' + 10));
-       if (c >= 'A' && c <= 'F')
-               return (IN6PTON_XDIGIT | (c - 'A' + 10));
+
+       val = hex_to_bin(c);
+       if (val >= 0)
+               return val | IN6PTON_XDIGIT | (val < 10 ? IN6PTON_DIGIT : 0);
+
        if (delim == -1)
                return IN6PTON_DELIM;
        return IN6PTON_UNKNOWN;