Skip to contentSkip to conversation

arch/ppc: Replace custom macro with isdigit()

PATCH NAK Tobias Klauser 3 participants 3 messages Sep 10, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 arch/ppc: Replace custom macro with isdigit()

Replace the custom is_digit() macro with isdigit() from <linux/ctype.h>

---

 arch/ppc/boot/common/misc-common.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
arch/ppc/boot/common/misc-common.c +3 -4
diff -urpN -X dontdiff linux-2.6.13/arch/ppc/boot/common/misc-common.c linux-2.6.13~macro_removal/arch/ppc/boot/common/misc-common.c
@@ -16,6 +16,7 @@
 
 #include <stdarg.h>	/* for va_ bits */
 #include <linux/config.h>
+#include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/zlib.h>
 #include "nonstdio.h"
@@ -301,8 +302,6 @@ _printk(char const *fmt, ...)
 	return;
 }
 
-#define is_digit(c) ((c >= '0') && (c <= '9'))
-
 void
 _vprintk(void(*putc)(const char), const char *fmt0, va_list ap)
 {
@@ -329,7 +328,7 @@ _vprintk(void(*putc)(const char), const 
 			{
 				zero_fill = FALSE;
 			}
-			while (is_digit(c))
+			while (isdigit(c))
 			{
 				left_prec = (left_prec * 10) + (c - '0');
 				c = *fmt0++;
@@ -338,7 +337,7 @@ _vprintk(void(*putc)(const char), const 
 			{
 				c = *fmt0++;
 				zero_fill++;
-				while (is_digit(c))
+				while (isdigit(c))
 				{
 					right_prec = (right_prec * 10) + (c - '0');
 					c = *fmt0++;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 1 line · Tobias Klauser

Replace the custom is_digit() macro with isdigit() from <linux/ctype.h>

NAK. No point pulling in 256 bytes of _ctype array when all we use it for is two '0' <= c <= '9' comparisons.

In fact Tom Rini maintains this code, so it's his opinion that counts.

Paul.

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Tobias Klauser
Quoted 3 lines · Tobias Klauser

Replace the custom is_digit() macro with isdigit() from <linux/ctype.h>

NAK, in the boot code we don't want to be adding dependanies on external things without good reason to.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors