about summary refs log tree commit diff
path: root/src/stdio/fgetln.c
Commit message (Collapse)AuthorAgeFilesLines
* fix null pointer subtraction and comparison in stdioRich Felker2018-09-161-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.
* include cleanups: remove unused headers and add feature test macrosSzabolcs Nagy2013-12-121-0/+1
|
* clean up stdio_impl.hRich Felker2012-11-081-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.
* add bsd fgetln functionRich Felker2012-08-111-0/+19
optimized to avoid allocation and return lines directly out of the stream buffer whenever possible.