sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit adf9f475250e56067c4409f8a515b0005f1a2f3b
parent bd67e7d92de6d768e726e268f927118fc5272c09
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue,  5 May 2015 14:53:19 +0200

Revert "libutil/getlines: use known line length"

This reverts commit c69a70ddfd5c2b1514d9efd1c7a0fcbee5b0d2e7.

Diffstat:
Mlibutil/getlines.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libutil/getlines.c b/libutil/getlines.c @@ -22,7 +22,7 @@ getlines(FILE *fp, struct linebuf *b) b->lines[b->nlines - 1] = memcpy(emalloc(linelen), line, linelen); } 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][linelen - 1] = '\n'; b->lines[b->nlines - 1][linelen] = '\0';