X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fstdio%2F__uflow.c;h=544dda982dbf0abf4ae703825d91e84ffd2bd94a;hp=5a51d6102a9a073f4cf31184eed5628e1b2728ba;hb=e3cd6c5c265cd481db6e0c5b529855d99f0bda30;hpb=ea343364a719add2cd8adf8a50c15bb5f9400dd8 diff --git a/src/stdio/__uflow.c b/src/stdio/__uflow.c index 5a51d610..544dda98 100644 --- a/src/stdio/__uflow.c +++ b/src/stdio/__uflow.c @@ -1,7 +1,11 @@ #include "stdio_impl.h" +/* This function will never be called if there is already data + * buffered for reading. Thus we can get by with very few branches. */ + int __uflow(FILE *f) { - if (__underflow(f) < 0) return EOF; - else return *f->rpos++; + unsigned char c = EOF; + if (f->rend || !__toread(f)) f->read(f, &c, 1); + return c; }