Revert "libutil/getlines: use known line length"
This reverts commit c69a70ddfd5c2b1514d9efd1c7a0fcbee5b0d2e7.
This commit is contained in:
parent
bd67e7d92d
commit
adf9f47525
@ -22,7 +22,7 @@ getlines(FILE *fp, struct linebuf *b)
|
|||||||
b->lines[b->nlines - 1] = memcpy(emalloc(linelen), line, linelen);
|
b->lines[b->nlines - 1] = memcpy(emalloc(linelen), line, linelen);
|
||||||
}
|
}
|
||||||
free(line);
|
free(line);
|
||||||
if (b->lines && b->nlines && b->lines[b->nlines - 1][linelen - 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] = erealloc(b->lines[b->nlines - 1], linelen + 1);
|
||||||
b->lines[b->nlines - 1][linelen - 1] = '\n';
|
b->lines[b->nlines - 1][linelen - 1] = '\n';
|
||||||
b->lines[b->nlines - 1][linelen] = '\0';
|
b->lines[b->nlines - 1][linelen] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user