summaryrefslogtreecommitdiff
path: root/src/stdio/fgetln.c
AgeCommit message (Collapse)AuthorFilesLines
2018-09-16fix null pointer subtraction and comparison in stdioRich Felker1-1/+1
morally, for null pointers a and b, a-b, a<b, and a>b should all be defined as 0; however, C does not define any of them. the stdio implementation makes heavy use of such pointer comparison and subtraction for buffer logic, and also uses null pos/base/end pointers to indicate that the FILE is not in the corresponding (read or write) mode ready for accesses through the buffer. all of the comparisons are fixed trivially by using != in place of the relational operators, since the opposite relation (e.g. pos>end) is logically impossible. the subtractions have been reviewed to check that they are conditional the stream being in the appropriate reading- or writing-through-buffer mode, with checks added where needed. in fgets and getdelim, the checks added should improve performance for unbuffered streams by avoiding a do-nothing call to memchr, and should be negligible for buffered streams.
2013-12-12include cleanups: remove unused headers and add feature test macrosSzabolcs Nagy1-0/+1
2012-11-08clean up stdio_impl.hRich Felker1-0/+1
this header evolved to facilitate the extremely lazy practice of omitting explicit includes of the necessary headers in individual stdio source files; not only was this sloppy, but it also increased build time. now, stdio_impl.h is only including the headers it needs for its own use; any further headers needed by source files are included directly where needed.
2012-08-11add bsd fgetln functionRich Felker1-0/+19
optimized to avoid allocation and return lines directly out of the stream buffer whenever possible.