X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2F__uflow.c;h=e28922c2ff461a960c37501d6cbe298fe8ca68f4;hb=8c0a3d9e5c169fc9d0f246ab59362b658b029ad7;hp=5a51d6102a9a073f4cf31184eed5628e1b2728ba;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/stdio/__uflow.c b/src/stdio/__uflow.c index 5a51d610..e28922c2 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; + if ((f->rend || !__toread(f)) && f->read(f, &c, 1)==1) return c; + return EOF; }