[hackers] [sbase] Revert "libutil/getlines: use known line length" || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Thu, 7 May 2015 19:18:55 +0200 (CEST)

commit adf9f475250e56067c4409f8a515b0005f1a2f3b
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue May 5 14:53:19 2015 +0200

    Revert "libutil/getlines: use known line length"
    
    This reverts commit c69a70ddfd5c2b1514d9efd1c7a0fcbee5b0d2e7.

diff --git a/libutil/getlines.c b/libutil/getlines.c
index 89664cc..820c781 100644
--- a/libutil/getlines.c
+++ b/libutil/getlines.c
_AT_@ -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';
Received on Thu May 07 2015 - 19:18:55 CEST

This archive was generated by hypermail 2.3.0 : Thu May 07 2015 - 19:24:13 CEST