diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-03-27 01:54:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-27 12:48:32 -0400 |
commit | 5a048e3b59fb4211b7978f78217878071c344379 (patch) | |
tree | 2de472f250062a39725f232cb5e467c12ccf53c8 /net/core/utils.c | |
parent | 05fcaeac05c56ebe5a336fe617c0a0db4dc7ae3b (diff) |
net: core: let's use native isxdigit instead of custom
In kernel we have fast and pretty implementation of the isxdigit() function.
Let's use it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/utils.c')
-rw-r--r-- | net/core/utils.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/utils.c b/net/core/utils.c index e3487e461939..3c7f5b51b979 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/ctype.h> | ||
20 | #include <linux/inet.h> | 21 | #include <linux/inet.h> |
21 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
22 | #include <linux/net.h> | 23 | #include <linux/net.h> |
@@ -348,9 +349,7 @@ int mac_pton(const char *s, u8 *mac) | |||
348 | 349 | ||
349 | /* Don't dirty result unless string is valid MAC. */ | 350 | /* Don't dirty result unless string is valid MAC. */ |
350 | for (i = 0; i < ETH_ALEN; i++) { | 351 | for (i = 0; i < ETH_ALEN; i++) { |
351 | if (!strchr("0123456789abcdefABCDEF", s[i * 3])) | 352 | if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1])) |
352 | return 0; | ||
353 | if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1])) | ||
354 | return 0; | 353 | return 0; |
355 | if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':') | 354 | if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':') |
356 | return 0; | 355 | return 0; |