(error_tail): Don't cast alloca to (void *); it's already (void *).
[gnulib.git] / lib / getndelim2.c
index fb75a3f..6f08689 100644 (file)
 /* Specification.  */
 #include "getndelim2.h"
 
-#if STDC_HEADERS
-# include <stdlib.h>
-#else
-char *malloc (), *realloc ();
-#endif
+#include <stdlib.h>
 
 #include "unlocked-io.h"
 
@@ -74,7 +70,7 @@ getndelim2 (char **lineptr, size_t *linesize, size_t nmax,
     {
       /* Here always *lineptr + *linesize == read_pos + nbytes_avail.  */
 
-      register int c = getc (stream);
+      register int c;
 
       /* We always want at least one char left in the buffer, since we
         always (unless we get an error while reading the first char)
@@ -99,7 +95,8 @@ getndelim2 (char **lineptr, size_t *linesize, size_t nmax,
            }
        }
 
-      if (c == EOF || ferror (stream))
+      c = getc (stream);
+      if (c == EOF)
        {
          /* Return partial line, if any.  */
          if (read_pos == *lineptr)