clean up stdio_impl.h
authorRich Felker <dalias@aerifal.cx>
Thu, 8 Nov 2012 21:39:41 +0000 (16:39 -0500)
committerRich Felker <dalias@aerifal.cx>
Thu, 8 Nov 2012 21:39:41 +0000 (16:39 -0500)
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.

41 files changed:
src/internal/floatscan.c
src/internal/intscan.c
src/internal/stdio_impl.h
src/stdio/__fdopen.c
src/stdio/__fopen_rb_ca.c
src/stdio/__stdio_read.c
src/stdio/__stdio_write.c
src/stdio/__stdout_write.c
src/stdio/__string_read.c
src/stdio/fgetln.c
src/stdio/fgets.c
src/stdio/fgetwc.c
src/stdio/fgetws.c
src/stdio/fmemopen.c
src/stdio/fopen.c
src/stdio/fputs.c
src/stdio/fputwc.c
src/stdio/fputws.c
src/stdio/fread.c
src/stdio/freopen.c
src/stdio/ftell.c
src/stdio/fwrite.c
src/stdio/getdelim.c
src/stdio/gets.c
src/stdio/getwc.c
src/stdio/getwchar.c
src/stdio/open_memstream.c
src/stdio/open_wmemstream.c
src/stdio/pclose.c
src/stdio/putwc.c
src/stdio/putwchar.c
src/stdio/ungetwc.c
src/stdio/vfprintf.c
src/stdio/vfscanf.c
src/stdio/vfwprintf.c
src/stdio/vsnprintf.c
src/stdio/vswprintf.c
src/stdio/vswscanf.c
src/stdlib/strtol.c
src/stdlib/wcstod.c
src/stdlib/wcstol.c

index 0825121..f6e331d 100644 (file)
@@ -4,6 +4,7 @@
 #include <float.h>
 #include <limits.h>
 #include <errno.h>
 #include <float.h>
 #include <limits.h>
 #include <errno.h>
+#include <ctype.h>
 
 #include "shgetc.h"
 #include "floatscan.h"
 
 #include "shgetc.h"
 #include "floatscan.h"
index 178cdf0..69350ef 100644 (file)
@@ -1,5 +1,6 @@
 #include <limits.h>
 #include <errno.h>
 #include <limits.h>
 #include <errno.h>
+#include <ctype.h>
 #include "shgetc.h"
 
 /* Lookup table for digit values. -1==255>=36 -> invalid */
 #include "shgetc.h"
 
 /* Lookup table for digit values. -1==255>=36 -> invalid */
index e9045f2..c9d20fa 100644 (file)
@@ -2,23 +2,6 @@
 #define _STDIO_IMPL_H
 
 #include <stdio.h>
 #define _STDIO_IMPL_H
 
 #include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <string.h>
-#include <inttypes.h>
-#include <wchar.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <ctype.h>
-#include <sys/wait.h>
-#include <math.h>
-#include <float.h>
-#include <sys/uio.h>
 #include "syscall.h"
 #include "libc.h"
 
 #include "syscall.h"
 #include "libc.h"
 
index df6ed71..59690f6 100644 (file)
@@ -1,4 +1,10 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <stdlib.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
 
 FILE *__fdopen(int fd, const char *mode)
 {
 
 FILE *__fdopen(int fd, const char *mode)
 {
index a1b1b3b..9202c8c 100644 (file)
@@ -1,4 +1,6 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <fcntl.h>
+#include <string.h>
 
 FILE *__fopen_rb_ca(const char *filename, FILE *f, unsigned char *buf, size_t len)
 {
 
 FILE *__fopen_rb_ca(const char *filename, FILE *f, unsigned char *buf, size_t len)
 {
index c99ca9a..05e56f9 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <sys/uio.h>
 #include <pthread.h>
 
 static void cleanup(void *p)
 #include <pthread.h>
 
 static void cleanup(void *p)
index cef7bbd..e52e91a 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <sys/uio.h>
 #include <pthread.h>
 
 static void cleanup(void *p)
 #include <pthread.h>
 
 static void cleanup(void *p)
index 0cf7123..200fe2c 100644 (file)
@@ -1,4 +1,6 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <termios.h>
+#include <sys/ioctl.h>
 
 size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
 {
 
 size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
 {
index de002fc..7b50a7e 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <string.h>
 
 size_t __string_read(FILE *f, unsigned char *buf, size_t len)
 {
 
 size_t __string_read(FILE *f, unsigned char *buf, size_t len)
 {
index 06b8883..a2e4bd3 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <string.h>
 
 char *fgetln(FILE *f, size_t *plen)
 {
 
 char *fgetln(FILE *f, size_t *plen)
 {
index ee0ac30..b01a418 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <string.h>
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
index 6f9f9ec..8626d54 100644 (file)
@@ -1,4 +1,6 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
+#include <errno.h>
 
 wint_t __fgetwc_unlocked(FILE *f)
 {
 
 wint_t __fgetwc_unlocked(FILE *f)
 {
index fab9bd0..195cb43 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
 
 wint_t __fgetwc_unlocked(FILE *);
 
 
 wint_t __fgetwc_unlocked(FILE *);
 
index 770fd99..91d52bc 100644 (file)
@@ -1,4 +1,7 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
 
 struct cookie {
        size_t pos, len, size;
 
 struct cookie {
        size_t pos, len, size;
index c741aed..da17ce8 100644 (file)
@@ -1,4 +1,7 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
 
 FILE *fopen(const char *restrict filename, const char *restrict mode)
 {
 
 FILE *fopen(const char *restrict filename, const char *restrict mode)
 {
index b41bc8c..1112b19 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <string.h>
 
 int fputs(const char *restrict s, FILE *restrict f)
 {
 
 int fputs(const char *restrict s, FILE *restrict f)
 {
index 45ea8c2..7b621dd 100644 (file)
@@ -1,4 +1,7 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
+#include <limits.h>
+#include <ctype.h>
 
 wint_t __fputwc_unlocked(wchar_t c, FILE *f)
 {
 
 wint_t __fputwc_unlocked(wchar_t c, FILE *f)
 {
index 0b593c0..5723cbc 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
 
 int fputws(const wchar_t *restrict ws, FILE *restrict f)
 {
 
 int fputws(const wchar_t *restrict ws, FILE *restrict f)
 {
index 3f31af8..c461256 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <string.h>
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
index 7ae116d..6c1b575 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <fcntl.h>
 
 /* The basic idea of this implementation is to open a new FILE,
  * hack the necessary parts of the new FILE into the old one, then
 
 /* The basic idea of this implementation is to open a new FILE,
  * hack the necessary parts of the new FILE into the old one, then
index 3904a1d..82371e3 100644 (file)
@@ -1,4 +1,6 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <limits.h>
+#include <errno.h>
 
 off_t __ftello_unlocked(FILE *f)
 {
 
 off_t __ftello_unlocked(FILE *f)
 {
index 8027b30..d5f6542 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <string.h>
 
 size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
 {
 
 size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
 {
index 5015c3a..26093a6 100644 (file)
@@ -1,4 +1,7 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <string.h>
+#include <inttypes.h>
+#include <errno.h>
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
 
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 
index 24319eb..6c4645e 100644 (file)
@@ -1,4 +1,6 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <limits.h>
+#include <string.h>
 
 char *gets(char *s)
 {
 
 char *gets(char *s)
 {
index a2818bc..a5008f0 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
 
 wint_t getwc(FILE *f)
 {
 
 wint_t getwc(FILE *f)
 {
index 2295bd4..bd89e0e 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
 
 wint_t getwchar(void)
 {
 
 wint_t getwchar(void)
 {
index 687e818..c7330ab 100644 (file)
@@ -1,4 +1,7 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
 
 struct cookie {
        char **bufp;
 
 struct cookie {
        char **bufp;
index a830b14..2fe504c 100644 (file)
@@ -1,4 +1,8 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
 
 struct cookie {
        wchar_t **bufp;
 
 struct cookie {
        wchar_t **bufp;
index 7fb76ed..080a426 100644 (file)
@@ -1,5 +1,6 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
-#include "syscall.h"
+#include <errno.h>
+#include <unistd.h>
 
 int pclose(FILE *f)
 {
 
 int pclose(FILE *f)
 {
index 80b54a4..4bb7473 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
 
 wint_t putwc(wchar_t c, FILE *f)
 {
 
 wint_t putwc(wchar_t c, FILE *f)
 {
index 3aacc1c..b249c4a 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
 
 wint_t putwchar(wchar_t c)
 {
 
 wint_t putwchar(wchar_t c)
 {
index 5282fee..8cc85a6 100644 (file)
@@ -1,4 +1,8 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
+#include <limits.h>
+#include <ctype.h>
+#include <string.h>
 
 wint_t ungetwc(wint_t c, FILE *f)
 {
 
 wint_t ungetwc(wint_t c, FILE *f)
 {
index 4a2752b..1e7e6a4 100644 (file)
@@ -1,4 +1,13 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <errno.h>
+#include <ctype.h>
+#include <limits.h>
+#include <string.h>
+#include <stdarg.h>
+#include <wchar.h>
+#include <inttypes.h>
+#include <math.h>
+#include <float.h>
 
 /* Some useful macros */
 
 
 /* Some useful macros */
 
index 54d0849..fe071e9 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <ctype.h>
@@ -9,6 +8,7 @@
 #include <errno.h>
 #include <math.h>
 #include <float.h>
 #include <errno.h>
 #include <math.h>
 #include <float.h>
+#include <inttypes.h>
 
 #include "stdio_impl.h"
 #include "shgetc.h"
 
 #include "stdio_impl.h"
 #include "shgetc.h"
index a42ba19..eb07931 100644 (file)
@@ -1,4 +1,11 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <errno.h>
+#include <ctype.h>
+#include <limits.h>
+#include <string.h>
+#include <stdarg.h>
+#include <wchar.h>
+#include <inttypes.h>
 
 /* Convenient bit representation for modifier flags, which all fall
  * within 31 codepoints of the space character. */
 
 /* Convenient bit representation for modifier flags, which all fall
  * within 31 codepoints of the space character. */
index 6f19b02..be2c44e 100644 (file)
@@ -1,4 +1,8 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <limits.h>
+#include <string.h>
+#include <errno.h>
+#include <stdint.h>
 
 static size_t sn_write(FILE *f, const unsigned char *s, size_t l)
 {
 
 static size_t sn_write(FILE *f, const unsigned char *s, size_t l)
 {
index f3d4fec..7d237ba 100644 (file)
@@ -1,4 +1,9 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <limits.h>
+#include <string.h>
+#include <errno.h>
+#include <stdint.h>
+#include <wchar.h>
 
 struct cookie {
        wchar_t *ws;
 
 struct cookie {
        wchar_t *ws;
index a205200..7a2f7c7 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
 #include "stdio_impl.h"
+#include <wchar.h>
 
 static size_t wstring_read(FILE *f, unsigned char *buf, size_t len)
 {
 
 static size_t wstring_read(FILE *f, unsigned char *buf, size_t len)
 {
index 23a2f3b..7ee8879 100644 (file)
@@ -1,6 +1,9 @@
 #include "stdio_impl.h"
 #include "intscan.h"
 #include "shgetc.h"
 #include "stdio_impl.h"
 #include "intscan.h"
 #include "shgetc.h"
+#include <inttypes.h>
+#include <limits.h>
+#include <ctype.h>
 
 static unsigned long long strtox(const char *s, char **p, int base, unsigned long long lim)
 {
 
 static unsigned long long strtox(const char *s, char **p, int base, unsigned long long lim)
 {
index 03670b0..83f308d 100644 (file)
@@ -1,6 +1,7 @@
 #include "shgetc.h"
 #include "floatscan.h"
 #include "stdio_impl.h"
 #include "shgetc.h"
 #include "floatscan.h"
 #include "stdio_impl.h"
+#include <wctype.h>
 
 /* This read function heavily cheats. It knows:
  *  (1) len will always be 1
 
 /* This read function heavily cheats. It knows:
  *  (1) len will always be 1
index 3d7c97d..4443f57 100644 (file)
@@ -1,6 +1,10 @@
 #include "stdio_impl.h"
 #include "intscan.h"
 #include "shgetc.h"
 #include "stdio_impl.h"
 #include "intscan.h"
 #include "shgetc.h"
+#include <inttypes.h>
+#include <limits.h>
+#include <wctype.h>
+#include <wchar.h>
 
 /* This read function heavily cheats. It knows:
  *  (1) len will always be 1
 
 /* This read function heavily cheats. It knows:
  *  (1) len will always be 1