From 099bce7f5d607bb8012faf4dc9fe6e034532eefe Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 2 Apr 2011 18:11:07 +0200 Subject: rev: use xrealloc from xalloc.h Signed-off-by: Sami Kerola --- text-utils/rev.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'text-utils/rev.c') diff --git a/text-utils/rev.c b/text-utils/rev.c index 89e5e5855..31004a070 100644 --- a/text-utils/rev.c +++ b/text-utils/rev.c @@ -125,19 +125,11 @@ int main(int argc, char *argv[]) /* This is my hack from setpwnam.c -janl */ while (buf[len-1] != '\n' && !feof(fp)) { - wchar_t *x; - /* Extend input buffer if it failed getting the whole line */ - /* So now we double the buffer size */ bufsiz *= 2; - x = realloc(buf, bufsiz * sizeof(wchar_t)); - if (!x) { - free(buf); - err(EXIT_FAILURE, _("realloc failed")); - } - buf = x; + buf = xrealloc(buf, bufsiz * sizeof(wchar_t)); /* And fill the rest of the buffer */ if (!fgetws(&buf[len], bufsiz/2, fp)) -- cgit v1.2.3-55-g7522