diff options
author | Rob Landley | 2006-06-18 20:20:07 +0000 |
---|---|---|
committer | Rob Landley | 2006-06-18 20:20:07 +0000 |
commit | ea224be6aa8fed5486376d3021a4cb911e935106 (patch) | |
tree | 38d6c5d2d53841e3f4e2702521e3b03235c51017 /libbb/dump.c | |
parent | 14d7065ef1eb836d20e13bc25d1b13f0e76185ac (diff) | |
download | busybox-ea224be6aa8fed5486376d3021a4cb911e935106.zip busybox-ea224be6aa8fed5486376d3021a4cb911e935106.tar.gz |
skip_whitespace() shouldn't claim its return value is const, it doesn't know
that and callers wind up typecasting it back.
Diffstat (limited to 'libbb/dump.c')
-rw-r--r-- | libbb/dump.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/libbb/dump.c b/libbb/dump.c index 1a54ebb..b12a8e2 100644 --- a/libbb/dump.c +++ b/libbb/dump.c @@ -10,11 +10,10 @@ * Original copyright notice is retained at the end of this file. */ -#include <stdlib.h> +#include "libbb.h" #include <string.h> #include <unistd.h> #include <ctype.h> /* for isdigit() */ -#include "libbb.h" #include "dump.h" enum _vflag bb_dump_vflag = FIRST; @@ -83,9 +82,9 @@ int bb_dump_size(FS * fs) static void rewrite(FS * fs) { enum { NOTOKAY, USEBCNT, USEPREC } sokay; - register PR *pr, **nextpr = NULL; - register FU *fu; - register char *p1, *p2, *p3; + PR *pr, **nextpr = NULL; + FU *fu; + char *p1, *p2, *p3; char savech, *fmtp; const char *byte_count_str; int nconv, prec = 0; @@ -98,7 +97,7 @@ static void rewrite(FS * fs) for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) { /* NOSTRICT */ /* DBU:[dvae@cray.com] calloc so that forward ptrs start out NULL*/ - pr = (PR *) xzalloc(sizeof(PR)); + pr = xzalloc(sizeof(PR)); if (!fu->nextpr) fu->nextpr = pr; /* ignore nextpr -- its unused inside the loop and is @@ -246,8 +245,7 @@ static void rewrite(FS * fs) { savech = *p3; *p3 = '\0'; - if (!(pr->fmt = realloc(pr->fmt, strlen(pr->fmt)+(p3-p2)+1))) - bb_perror_msg_and_die("hexdump"); + pr->fmt = xrealloc(pr->fmt, strlen(pr->fmt)+(p3-p2)+1); strcat(pr->fmt, p2); *p3 = savech; p2 = p3; @@ -673,17 +671,16 @@ int bb_dump_dump(char **argv) void bb_dump_add(const char *fmt) { - register const char *p; - register char *p1; - register char *p2; + const char *p; + char *p1; + char *p2; static FS **nextfs; FS *tfs; FU *tfu, **nextfu; const char *savep; /* start new linked list of format units */ - /* NOSTRICT */ - tfs = (FS *) xzalloc(sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */ + tfs = xzalloc(sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */ if (!bb_dump_fshead) { bb_dump_fshead = tfs; } else { @@ -695,7 +692,7 @@ void bb_dump_add(const char *fmt) /* take the format string and break it up into format units */ for (p = fmt;;) { /* bb_dump_skip leading white space */ - p = bb_skip_whitespace(p); + p = skip_whitespace(p); if (!*p) { break; } @@ -703,7 +700,7 @@ void bb_dump_add(const char *fmt) /* allocate a new format unit and link it in */ /* NOSTRICT */ /* DBU:[dave@cray.com] calloc so that forward pointers start out NULL */ - tfu = (FU *) xzalloc(sizeof(FU)); + tfu = xzalloc(sizeof(FU)); *nextfu = tfu; nextfu = &tfu->nextfu; tfu->reps = 1; @@ -718,12 +715,12 @@ void bb_dump_add(const char *fmt) tfu->reps = atoi(savep); tfu->flags = F_SETREP; /* bb_dump_skip trailing white space */ - p = bb_skip_whitespace(++p); + p = skip_whitespace(++p); } /* bb_dump_skip slash and trailing white space */ if (*p == '/') { - p = bb_skip_whitespace(++p); + p = skip_whitespace(++p); } /* byte count */ @@ -734,7 +731,7 @@ void bb_dump_add(const char *fmt) } tfu->bcnt = atoi(savep); /* bb_dump_skip trailing white space */ - p = bb_skip_whitespace(++p); + p = skip_whitespace(++p); } /* format */ |