[hackers] [sbase] Make getlines() less verbose || sin

From: <git_AT_suckless.org>
Date: Thu, 12 Feb 2015 15:34:57 +0100 (CET)

commit 0c32ceb414206d4fdd910946979245dc59cb67fc
Author: sin <sin_AT_2f30.org>
Date: Thu Feb 12 14:33:46 2015 +0000

    Make getlines() less verbose
    
    Thanks Roberto for the suggestion.

diff --git a/libutil/getlines.c b/libutil/getlines.c
index 95ce0b9..30eb721 100644
--- a/libutil/getlines.c
+++ b/libutil/getlines.c
_AT_@ -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')) {
Received on Thu Feb 12 2015 - 15:34:57 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 12 2015 - 15:36:09 CET