diff options
author | hpa <hpa> | 2001-12-13 05:27:15 +0000 |
---|---|---|
committer | hpa <hpa> | 2001-12-13 05:27:15 +0000 |
commit | 610b4664403375b2fa55abaf4f605868f9b21731 (patch) | |
tree | eaaa5cab147c07e2d3a9ca030f36603ac5a5e351 | |
parent | 6b190cc5cf21708b6aacc50c9050e074f67bed90 (diff) | |
download | syslinux-610b4664403375b2fa55abaf4f605868f9b21731.tar.gz |
Fix the command-line parser, compile with -Wall
-rw-r--r-- | memdisk/Makefile | 4 | ||||
-rw-r--r-- | memdisk/e820func.c | 2 | ||||
-rw-r--r-- | memdisk/setup.c | 21 |
3 files changed, 13 insertions, 14 deletions
diff --git a/memdisk/Makefile b/memdisk/Makefile index b3abf5a0..70d6f69d 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -12,7 +12,7 @@ ## ----------------------------------------------------------------------- CC = gcc -CFLAGS = -O2 -fomit-frame-pointer -march=i386 \ +CFLAGS = -Wall -O2 -fomit-frame-pointer -march=i386 \ -malign-functions=0 -malign-jumps=0 -malign-loops=0 LDFLAGS = AS = as @@ -31,7 +31,7 @@ tidy: rm -f *.o *.s *.o16 *.s16 *.bin *.lst *.elf e820test # clean also removes the product binary -clean: +clean: tidy rm -f memdisk %.o16: %.s16 diff --git a/memdisk/e820func.c b/memdisk/e820func.c index 4d0ec150..3087d33e 100644 --- a/memdisk/e820func.c +++ b/memdisk/e820func.c @@ -52,7 +52,7 @@ static void insertrange_at(int where, uint64_t start, uint32_t type) void insertrange(uint64_t start, uint64_t len, uint32_t type) { - uint64_t newstart, last; + uint64_t last; uint32_t oldtype; int i, j; diff --git a/memdisk/setup.c b/memdisk/setup.c index 0fa9dbf9..8543298f 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -188,35 +188,33 @@ rdz_32(uint32_t addr) * Routine to seek for a command-line item and return a pointer * to the data portion, if present */ -static inline int -isspace(int ch) -{ - return (ch == ' ') || ((ch >= '\b') && (ch <= '\r')); -} /* Magic return values */ #define CMD_NOTFOUND ((char *)-1) /* Not found */ #define CMD_BOOL ((char *)-2) /* Found boolean option */ #define CMD_HASDATA(X) ((int)(X) >= 0) + const char *getcmditem(const char *what) { - const char *p, *wp; + const char *p; + const char *wp = what; int match = 0; for ( p = shdr->cmdline ; *p ; p++ ) { switch ( match ) { case 0: /* Ground state */ - if ( isspace(*p) ) + if ( *p == ' ' ) break; wp = what; + match = 1; /* Fall through */ case 1: /* Matching */ if ( *wp == '\0' ) { if ( *p == '=' ) return p+1; - else if ( isspace(*p) ) + else if ( *p == ' ' ) return CMD_BOOL; else { match = 2; @@ -224,12 +222,13 @@ const char *getcmditem(const char *what) } } if ( *p != *wp++ ) - match = 2; /* Skipping bogus */ + match = 2; break; - case 2: - if ( isspace(*p) ) + case 2: /* Mismatch, skip rest of option */ + if ( *p == ' ' ) match = 0; /* Next option */ + break; } } |