summaryrefslogtreecommitdiffstats
path: root/text-utils/rev.c
diff options
context:
space:
mode:
authorSami Kerola2011-04-02 18:11:07 +0200
committerKarel Zak2011-04-06 10:44:59 +0200
commit099bce7f5d607bb8012faf4dc9fe6e034532eefe (patch)
tree1b44d8a4bc458bdec1e58c956b0dae6b7f20c0d3 /text-utils/rev.c
parentpartx: trivial comment fix (diff)
downloadkernel-qcow2-util-linux-099bce7f5d607bb8012faf4dc9fe6e034532eefe.tar.gz
kernel-qcow2-util-linux-099bce7f5d607bb8012faf4dc9fe6e034532eefe.tar.xz
kernel-qcow2-util-linux-099bce7f5d607bb8012faf4dc9fe6e034532eefe.zip
rev: use xrealloc from xalloc.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'text-utils/rev.c')
-rw-r--r--text-utils/rev.c10
1 files changed, 1 insertions, 9 deletions
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))