X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgetndelim2.c;h=6f0868999525c671560ad97759abc0dec2de4cff;hb=22c1c15d0a29a1b7ea75456abe3f7062f835c887;hp=fb75a3f276b7842b5f179d44ccf6654cbfcd3023;hpb=a77fc1328324ba9f5b8466376aa668d76d4972e0;p=gnulib.git diff --git a/lib/getndelim2.c b/lib/getndelim2.c index fb75a3f27..6f0868999 100644 --- a/lib/getndelim2.c +++ b/lib/getndelim2.c @@ -27,11 +27,7 @@ /* Specification. */ #include "getndelim2.h" -#if STDC_HEADERS -# include -#else -char *malloc (), *realloc (); -#endif +#include #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)