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

STALE7668d

3 messages, 3 authors, 2005-09-10 · open the first message on its own page

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

From: Tobias Klauser <hidden>
Date: 2005-09-10 12:49:52

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

Signed-off-by: Tobias Klauser <redacted>

---

 arch/ppc/boot/common/misc-common.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

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
--- linux-2.6.13/arch/ppc/boot/common/misc-common.c	2005-08-29 01:41:01.000000000 +0200
+++ linux-2.6.13~macro_removal/arch/ppc/boot/common/misc-common.c	2005-09-10 12:38:31.000000000 +0200
@@ -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++;

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

From: Paul Mackerras <hidden>
Date: 2005-09-10 13:26:14

Tobias Klauser writes:
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.

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

From: Tom Rini <hidden>
Date: 2005-09-10 16:23:39

On Sat, Sep 10, 2005 at 02:16:33PM +0200, Tobias Klauser wrote:
Replace the custom is_digit() macro with isdigit() from <linux/ctype.h>

Signed-off-by: Tobias Klauser <redacted>
NAK, in the boot code we don't want to be adding dependanies on external
things without good reason to.

-- 
Tom Rini
http://gate.crashing.org/~trini/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help