From: David Lawrence Ramsey Date: Tue, 17 Aug 2004 19:20:05 +0000 (+0000) Subject: fix the last ngetdelim() tweak X-Git-Tag: v1.3.4~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=c08368bd1901a0db21544f61913d97f55638a019;p=nano.git fix the last ngetdelim() tweak git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1903 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- 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. */