fix the last ngetdelim() tweak
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1903 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
b4041d6821
commit
c08368bd19
|
@ -284,12 +284,12 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
||||||
|
|
||||||
/* Make room for the null character. */
|
/* Make room for the null character. */
|
||||||
if (indx >= *n) {
|
if (indx >= *n) {
|
||||||
*lineptr = charealloc(*lineptr, indx + 1);
|
*lineptr = charealloc(*lineptr, *n + 128);
|
||||||
*n = indx + 1;
|
*n += 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Null terminate the buffer. */
|
/* Null terminate the buffer. */
|
||||||
(*lineptr)[indx++] = '\0';
|
null_at(lineptr, indx++);
|
||||||
|
|
||||||
/* The last line may not have the delimiter, we have to return what
|
/* 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. */
|
* we got and the error will be seen on the next iteration. */
|
||||||
|
|
Loading…
Reference in New Issue