commit 0c32ceb414206d4fdd910946979245dc59cb67fc
Author: sin <[email protected]>
Date: Thu Feb 12 14:33:46 2015 +0000
Make getlines() less verbose
Thanks Roberto for the suggestion.
diff --git a/libutil/getlines.c b/libutil/getlines.c
index 95ce0b9..30eb721 100644
--- a/libutil/getlines.c
+++ b/libutil/getlines.c
@@ -20,8 +20,7 @@ getlines(FILE *fp, struct linebuf *b)
b->lines = nline;
}
linelen = len + 1;
- b->lines[b->nlines - 1] = emalloc(linelen);
- memcpy(b->lines[b->nlines - 1], line, linelen);
+ b->lines[b->nlines - 1] = memcpy(emalloc(linelen), line,
linelen);
}
free(line);
if (!strchr(b->lines[b->nlines - 1], '\n')) {