]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
rev: use xrealloc from xalloc.h
authorSami Kerola <kerolasa@iki.fi>
Sat, 2 Apr 2011 16:11:07 +0000 (18:11 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Apr 2011 08:44:59 +0000 (10:44 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
text-utils/rev.c

index 89e5e585548ce5f6a63b1b582066fd27635f3c74..31004a07001f8db0f2534d775461b3713b416651 100644 (file)
@@ -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))