Make getlines() less verbose

Thanks Roberto for the suggestion.
This commit is contained in:
sin 2015-02-12 14:33:46 +00:00
parent 9565eef895
commit 113caaf677
1 changed files with 1 additions and 2 deletions

View File

@ -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')) {