From c08368bd1901a0db21544f61913d97f55638a019 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 17 Aug 2004 19:20:05 +0000 Subject: [PATCH] fix the last ngetdelim() tweak git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1903 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.c b/src/utils.c index d11465dc..4c52d1d3 100644 --- a/src/utils.c +++ b/src/utils.c @@ -284,12 +284,12 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream) /* Make room for the null character. */ if (indx >= *n) { - *lineptr = charealloc(*lineptr, indx + 1); - *n = indx + 1; + *lineptr = charealloc(*lineptr, *n + 128); + *n += 128; } /* Null terminate the buffer. */ - (*lineptr)[indx++] = '\0'; + null_at(lineptr, indx++); /* The last line may not have the delimiter, we have to return what * we got and the error will be seen on the next iteration. */ -- 2.39.5