diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-05-03 17:13:29 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-05-03 17:13:29 +0000 |
commit | 2600738fabff22295d51826e3ab5f34098f09bdf (patch) | |
tree | ee58fff7deaeb65cc534f7ec263a9a9cba29c1bd /usr.bin/xargs | |
parent | a1aec7d10e4d0a1c547c2aecf9441d2615773553 (diff) | |
download | FreeBSD-src-2600738fabff22295d51826e3ab5f34098f09bdf.zip FreeBSD-src-2600738fabff22295d51826e3ab5f34098f09bdf.tar.gz |
Get rid of bogus holder for realloc(3).
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r-- | usr.bin/xargs/xargs.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index f0b5854..ea1e3f1 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -255,10 +255,9 @@ arg2: *p++ = '\0'; *xp++ = argp; if (Iflag) { - char *realloc_holder; size_t curlen; - realloc_holder = inpline; - if (realloc_holder == NULL) + + if (inpline == NULL) curlen = 0; else { /* @@ -267,7 +266,7 @@ arg2: * seperation before the next * argument. */ - if (*inpline != '\0') + if ((curlen = strlen(inpline))) strcat(inpline, " "); } curlen++; @@ -277,8 +276,8 @@ arg2: * a space next time through, if we have * to. */ - inpline = realloc(realloc_holder, strlen(argp) + - curlen + 2); + inpline = realloc(inpline, curlen + 2 + + strlen(argp)); if (inpline == NULL) err(1, "realloc"); if (curlen == 1) |