Make getlines() less verbose
Thanks Roberto for the suggestion.
This commit is contained in:
parent
9565eef895
commit
113caaf677
@ -20,8 +20,7 @@ getlines(FILE *fp, struct linebuf *b)
|
|||||||
b->lines = nline;
|
b->lines = nline;
|
||||||
}
|
}
|
||||||
linelen = len + 1;
|
linelen = len + 1;
|
||||||
b->lines[b->nlines - 1] = emalloc(linelen);
|
b->lines[b->nlines - 1] = memcpy(emalloc(linelen), line, linelen);
|
||||||
memcpy(b->lines[b->nlines - 1], line, linelen);
|
|
||||||
}
|
}
|
||||||
free(line);
|
free(line);
|
||||||
if (!strchr(b->lines[b->nlines - 1], '\n')) {
|
if (!strchr(b->lines[b->nlines - 1], '\n')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user