commit 27f258dd3483ba894e047f9394fdf8c484e14b48
parent 9f974301438f0063637e1330cdb829df12cd5081
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 29 Mar 2015 21:55:34 +0200
libutil/getlines: style fix
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libutil/getlines.c b/libutil/getlines.c
@@ -22,9 +22,7 @@ getlines(FILE *fp, struct linebuf *b)
b->lines[b->nlines - 1] = memcpy(emalloc(linelen), line, linelen);
}
free(line);
- if(!b->nlines || !b->lines)
- return;
- if (!strchr(b->lines[b->nlines - 1], '\n')) {
+ if (b->lines && b->nlines && !strchr(b->lines[b->nlines - 1], '\n')) {
b->lines[b->nlines - 1] = erealloc(b->lines[b->nlines - 1], linelen + 1);
b->lines[b->nlines - 1][linelen - 1] = '\n';
b->lines[b->nlines - 1][linelen] = '\0';