diff options
| author | Takashi Iwai <tiwai@suse.de> | 2010-11-03 15:51:26 +0100 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2010-11-03 15:51:26 +0100 |
| commit | 69dbdd819599e2f3b77c172e83af512845bca5ad (patch) | |
| tree | 49939d8b80ec2115a801eae2aebc21f23867c876 /net/core/utils.c | |
| parent | 87232dd49aeb6b7d1af291edca8bd129a82ef4b5 (diff) | |
| parent | 75e3f3137cb570661c2ad3035a139dda671fbb63 (diff) | |
Merge branch 'fix/asoc' into for-linus
Diffstat (limited to 'net/core/utils.c')
| -rw-r--r-- | net/core/utils.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/core/utils.c b/net/core/utils.c index f4185447053..5fea0ab2190 100644 --- a/net/core/utils.c +++ b/net/core/utils.c @@ -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; |
