sbase

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

commit 43ba70899ae5f375ff3cf2dd6f1f3c601cd6c106
parent c69a70ddfd5c2b1514d9efd1c7a0fcbee5b0d2e7
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue May  5 14:53:19 +0200

Revert "libutil/getlines: use known line length"

This reverts commit c69a70ddfd5c2b1514d9efd1c7a0fcbee5b0d2e7.

Diffstat:
libutil/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';