nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit c08368bd1901a0db21544f61913d97f55638a019
parent b4041d6821494a62094c0de4aca58fcc14fa2107
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Tue, 17 Aug 2004 19:20:05 +0000

fix the last ngetdelim() tweak


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1903 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
Msrc/utils.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 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. */