]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
net: core: let's use native isxdigit instead of custom
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 27 Mar 2013 05:54:13 +0000 (05:54 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 Mar 2013 16:48:32 +0000 (12:48 -0400)
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>
net/core/utils.c

index e3487e46193912fec01410593fcbcb49266ce374..3c7f5b51b979c88a3dc1d0bc9cf6c44f2e74d182 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/jiffies.h>
 #include <linux/kernel.h>
+#include <linux/ctype.h>
 #include <linux/inet.h>
 #include <linux/mm.h>
 #include <linux/net.h>
@@ -348,9 +349,7 @@ int mac_pton(const char *s, u8 *mac)
 
        /* Don't dirty result unless string is valid MAC. */
        for (i = 0; i < ETH_ALEN; i++) {
-               if (!strchr("0123456789abcdefABCDEF", s[i * 3]))
-                       return 0;
-               if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1]))
+               if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1]))
                        return 0;
                if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':')
                        return 0;