netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: core: let's use native isxdigit instead of custom
@ 2013-03-27 15:54 Andy Shevchenko
  2013-03-27 15:54 ` [PATCH 2/2] ppp: reuse print_hex_dump_bytes Andy Shevchenko
  2013-03-27 17:09 ` [PATCH 1/2] net: core: let's use native isxdigit instead of custom David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2013-03-27 15:54 UTC (permalink / raw)
  To: Paul Mackerras, David S. Miller, linux-ppp, netdev; +Cc: Andy Shevchenko

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>
---
 net/core/utils.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/core/utils.c b/net/core/utils.c
index e3487e46..3c7f5b5 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -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;
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-27 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 15:54 [PATCH 1/2] net: core: let's use native isxdigit instead of custom Andy Shevchenko
2013-03-27 15:54 ` [PATCH 2/2] ppp: reuse print_hex_dump_bytes Andy Shevchenko
2013-03-27 17:09   ` David Miller
2013-03-27 17:09 ` [PATCH 1/2] net: core: let's use native isxdigit instead of custom David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).