sbase

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

commit 51680535ce4d929a40e2ffa85d64c2aa6f57f90f
parent 66a5ea722d18fc76ce7c5c4323e8cfebe58e7517
Author: sin <sin@2f30.org>
Date:   Wed, 11 Feb 2015 00:27:30 +0000

getlines: Style fix

Diffstat:
Mlibutil/getlines.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libutil/getlines.c b/libutil/getlines.c @@ -20,13 +20,13 @@ 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] = emalloc(linelen); + memcpy(b->lines[b->nlines - 1], line, linelen); } free(line); - if (strchr(b->lines[b->nlines-1], '\n') == NULL) { - 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'; + if (!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'; } }