From ea224be6aa8fed5486376d3021a4cb911e935106 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 18 Jun 2006 20:20:07 +0000 Subject: skip_whitespace() shouldn't claim its return value is const, it doesn't know that and callers wind up typecasting it back. --- libbb/dump.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'libbb/dump.c') diff --git a/libbb/dump.c b/libbb/dump.c index 1a54ebbd9..b12a8e223 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 +#include "libbb.h" #include #include #include /* 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 */ -- cgit v1.2.3