]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
iogetline.c (_IO_getline_info): Don't read anything for N == 0.
authorJeff Law <law@gcc.gnu.org>
Tue, 25 Aug 1998 19:00:00 +0000 (13:00 -0600)
committerJeff Law <law@gcc.gnu.org>
Tue, 25 Aug 1998 19:00:00 +0000 (13:00 -0600)
(
        * libio/iogetline.c (_IO_getline_info): Don't read anything for
        N == 0.  Patch by HJ Lu.

From-SVN: r21980

libio/iogetline.c

index 631db78d12762e6109c51e294467a481e22b40d7..5aac9b56387e9aa9aedab20f06baf9ea6b1b3639 100644 (file)
@@ -58,7 +58,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
 {
   char *ptr = buf;
   if (eof) *eof = 0;
-  do
+  while (n != 0)
     {
       _IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
       if (len <= 0)
@@ -105,7 +105,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
            ptr += len;
            n -= len;
          }
-    } while (n != 0);
+    }
   return ptr - buf;
 }