# HG changeset patch # User Rob Landley # Date 1378792895 18000 # Node ID 4263a43907587be3ce5d566872159011e6f4a91a # Parent 9211bc984285ff04a3abcae15944f11113990920 Remove two unused functions and shrink another. diff -r 9211bc984285 -r 4263a4390758 lib/pending.c --- a/lib/pending.c Mon Sep 09 11:39:18 2013 -0500 +++ b/lib/pending.c Tue Sep 10 01:01:35 2013 -0500 @@ -38,38 +38,15 @@ { unsigned long rvalue = 0; char *ptr; - if(*numstr == '-' || *numstr == '+' || isspace(*numstr)) perror_exit("invalid number '%s'", numstr); + + if (!isdigit(*numstr)) perror_exit("bad number '%s'", numstr); errno = 0; rvalue = strtoul(numstr, &ptr, 10); - if(errno || numstr == ptr) perror_exit("invalid number '%s'", numstr); - if(*ptr) perror_exit("invalid number '%s'", numstr); - if(rvalue >= lowrange && rvalue <= highrange) return rvalue; - else { - perror_exit("invalid number '%s'", numstr); - return rvalue; //Not reachable; to avoid waring message. - } -} -/* - * strcat to mallocated buffer - * reallocate if need be - */ -char *astrcat (char *x, char *y) { - char *z; - z = x; - x = realloc (x, (x ? strlen (x) : 0) + strlen (y) + 1); - if (!x) return 0; - (z ? strcat : strcpy) (x, y); - return x; -} + if (errno || numstr == ptr || *ptr || rvalue < lowrange || rvalue > highrange) + perror_exit("bad number '%s'", numstr); -/* - * astrcat, but die on failure - */ -char *xastrcat (char *x, char *y) { - x = astrcat (x, y); - if (!x) error_exit ("xastrcat"); - return x; + return rvalue; } void daemonize(void)