major stdio overhaul, using readv/writev, plus other changes
[musl] / src / stdio / __uflow.c
index 5a51d61..544dda9 100644 (file)
@@ -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;
 }