Mercurial > hg > octave-lyh > gnulib-hg
changeset 1991:e7ed29061994
(readline): Do not leave room for an extra
byte after the newline; it's no longer needed.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Thu, 04 Nov 1999 23:12:42 +0000 |
parents | df746ba7ade6 |
children | da00e3cba254 |
files | lib/linebuffer.c |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/linebuffer.c +++ b/lib/linebuffer.c @@ -41,8 +41,7 @@ /* Read an arbitrarily long line of text from STREAM into LINEBUFFER. Keep the newline; append a newline if it's the last line of a file - that ends in a non-newline character. Do not null terminate, - but leave room for an extra byte after the newline. + that ends in a non-newline character. Do not null terminate. Return LINEBUFFER, except at end of file return 0. */ struct linebuffer * @@ -51,7 +50,7 @@ int c; char *buffer = linebuffer->buffer; char *p = linebuffer->buffer; - char *end = buffer + linebuffer->size - 1; /* Sentinel. */ + char *end = buffer + linebuffer->size; /* Sentinel. */ if (feof (stream) || ferror (stream)) return 0; @@ -73,7 +72,7 @@ buffer = (char *) xrealloc (buffer, linebuffer->size); p = p - linebuffer->buffer + buffer; linebuffer->buffer = buffer; - end = buffer + linebuffer->size - 1; + end = buffer + linebuffer->size; } *p++ = c; }