Commit e94bc5f2 by Ulrich Drepper Committed by Ulrich Drepper

(_IO_getline_info): Don't read anything for N==0.

From-SVN: r21973
parent 55895a7a
1998-08-25 14:34 Ulrich Drepper <drepper@cygnus.com>
* libio/iogetline.c (_IO_getline_info): Don't read anything for
N == 0. Patch by HJ Lu.
1998-08-23 Mark Mitchell <mark@markmitchell.com> 1998-08-23 Mark Mitchell <mark@markmitchell.com>
* iomanip.h: Use __extension__ for `extern' explicit template * iomanip.h: Use __extension__ for `extern' explicit template
......
...@@ -58,7 +58,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof) ...@@ -58,7 +58,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
{ {
char *ptr = buf; char *ptr = buf;
if (eof) *eof = 0; if (eof) *eof = 0;
do while (n != 0)
{ {
_IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr; _IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
if (len <= 0) if (len <= 0)
...@@ -105,7 +105,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof) ...@@ -105,7 +105,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
ptr += len; ptr += len;
n -= len; n -= len;
} }
} while (n != 0); }
return ptr - buf; return ptr - buf;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment