Commit 05b981f4 authored by Vincent Bernat's avatar Vincent Bernat Committed by Michael Ellerman

powerpc/xmon: use isspace/isxdigit/isalnum from linux/ctype.h

isxdigit() macro definition is the same.

isalnum() from linux/ctype.h will accept additional latin non-ASCII
characters. This is harmless since this macro is used in scanhex() which
parses user input.

isspace() from linux/ctype.h will accept vertical tab and form feed but
not NULL. The use of this macro is modified to accept NULL as
well. Additional characters are harmless since this macro is also only
used in scanhex().
Signed-off-by: default avatarVincent Bernat <vincent@bernat.im>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent e3a8446a
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/nmi.h> #include <linux/nmi.h>
#include <linux/ctype.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/string.h> #include <asm/string.h>
...@@ -183,14 +184,6 @@ extern void xmon_leave(void); ...@@ -183,14 +184,6 @@ extern void xmon_leave(void);
#define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3]) #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
#endif #endif
#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
|| ('a' <= (c) && (c) <= 'f') \
|| ('A' <= (c) && (c) <= 'F'))
#define isalnum(c) (('0' <= (c) && (c) <= '9') \
|| ('a' <= (c) && (c) <= 'z') \
|| ('A' <= (c) && (c) <= 'Z'))
#define isspace(c) (c == ' ' || c == '\t' || c == 10 || c == 13 || c == 0)
static char *help_string = "\ static char *help_string = "\
Commands:\n\ Commands:\n\
b show breakpoints\n\ b show breakpoints\n\
...@@ -2164,9 +2157,6 @@ static void dump_pacas(void) ...@@ -2164,9 +2157,6 @@ static void dump_pacas(void)
} }
#endif #endif
#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
|| ('a' <= (c) && (c) <= 'f') \
|| ('A' <= (c) && (c) <= 'F'))
static void static void
dump(void) dump(void)
{ {
...@@ -2569,7 +2559,7 @@ scanhex(unsigned long *vp) ...@@ -2569,7 +2559,7 @@ scanhex(unsigned long *vp)
int i; int i;
for (i=0; i<63; i++) { for (i=0; i<63; i++) {
c = inchar(); c = inchar();
if (isspace(c)) { if (isspace(c) || c == '\0') {
termch = c; termch = c;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment