commit 113caaf67725d65dd2c57d379bf92ee44712e52f
parent 9565eef8957c316806a2787dda15421d755307ee
Author: sin <sin@2f30.org>
Date: Thu, 12 Feb 2015 14:33:46 +0000
Make getlines() less verbose
Thanks Roberto for the suggestion.
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git 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')) {