From 7f5802c144c53b538fd8abe45336c591d7ee3732 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Sun, 17 May 2026 00:33:55 +0100 Subject: [PATCH] Tidy up get_line_alloc() --- src/util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util.c b/src/util.c index 1d98951..8498899 100644 --- a/src/util.c +++ b/src/util.c @@ -1046,14 +1046,15 @@ int get_line_alloc(FILE *f, char **buffp, size_t *sizep) { void *new; - if ((new = whine_realloc(*buffp, cnt + 1024))) + if ((new = whine_realloc(buff, cnt + 1024))) { buff = *buffp = new; *sizep = cnt + 1024; } else { - /* allocation failed, ignore line. Whine_realloc will have complained. */ + /* allocation failed, ignore line. + Whine_realloc will have complained. */ while (c != '\n' && c != EOF) c = getc(f); @@ -1067,7 +1068,7 @@ int get_line_alloc(FILE *f, char **buffp, size_t *sizep) if (c == '\n') return 1; - if (c == EOF) /* handle last line with no '\n' */ + if (c == EOF) { /* handle last line without '\n' */ if (cnt != 0)