Tidy up get_line_alloc()

This commit is contained in:
Simon Kelley committed 2026-05-17 00:33:55 +01:00
1 parent 7280e46aa5
commit 7f5802c144
1 file changed
+4 -3
+4 -3
View File
@@ -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)