From 36166b159309632a2f5485f5312952e2c97bcc63 Mon Sep 17 00:00:00 2001 From: hpa Date: Wed, 10 Dec 2003 20:44:57 +0000 Subject: [PATCH] Split atou() and skip_atou() into separate modules --- sample/Makefile | 2 +- sample/atou.c | 9 --------- sample/skipatou.c | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 sample/skipatou.c diff --git a/sample/Makefile b/sample/Makefile index fcb8f4c..8964c00 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -27,7 +27,7 @@ OBJCOPY = objcopy PPMTOLSS16 = ../ppmtolss16 LIB = libcom32.a -LIBOBJS = conio.o atou.o printf.o +LIBOBJS = conio.o atou.o skipatou.o printf.o .SUFFIXES: .lss .c .o .elf .c32 diff --git a/sample/atou.c b/sample/atou.c index 0ea1bfe..3658599 100644 --- a/sample/atou.c +++ b/sample/atou.c @@ -4,15 +4,6 @@ isdigit(int ch) return (ch >= '0') && (ch <= '9'); } -unsigned int skip_atou(const char **s) -{ - int i=0; - - while (isdigit(**s)) - i = i*10 + *((*s)++) - '0'; - return i; -} - unsigned int atou(const char *s) { unsigned int i = 0; diff --git a/sample/skipatou.c b/sample/skipatou.c new file mode 100644 index 0000000..9888153 --- /dev/null +++ b/sample/skipatou.c @@ -0,0 +1,14 @@ +static inline int +isdigit(int ch) +{ + return (ch >= '0') && (ch <= '9'); +} + +unsigned int skip_atou(const char **s) +{ + int i=0; + + while (isdigit(**s)) + i = i*10 + *((*s)++) - '0'; + return i; +} -- 2.7.4