summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-11-08 16:39:41 -0500
committerRich Felker <dalias@aerifal.cx>2012-11-08 16:39:41 -0500
commit835f9f950e2f6059532bd9ab9857a856ed21a4fd (patch)
tree496ea32dceca7e6573a534dfcfab26e322f0a0c6
parent1e717ea3d2a864e00e507f1a70a892c551955f1b (diff)
downloadmusl-835f9f950e2f6059532bd9ab9857a856ed21a4fd.tar.gz
musl-835f9f950e2f6059532bd9ab9857a856ed21a4fd.tar.bz2
musl-835f9f950e2f6059532bd9ab9857a856ed21a4fd.tar.xz
musl-835f9f950e2f6059532bd9ab9857a856ed21a4fd.zip
clean up stdio_impl.h
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.
-rw-r--r--src/internal/floatscan.c1
-rw-r--r--src/internal/intscan.c1
-rw-r--r--src/internal/stdio_impl.h17
-rw-r--r--src/stdio/__fdopen.c6
-rw-r--r--src/stdio/__fopen_rb_ca.c2
-rw-r--r--src/stdio/__stdio_read.c1
-rw-r--r--src/stdio/__stdio_write.c1
-rw-r--r--src/stdio/__stdout_write.c2
-rw-r--r--src/stdio/__string_read.c1
-rw-r--r--src/stdio/fgetln.c1
-rw-r--r--src/stdio/fgets.c1
-rw-r--r--src/stdio/fgetwc.c2
-rw-r--r--src/stdio/fgetws.c1
-rw-r--r--src/stdio/fmemopen.c3
-rw-r--r--src/stdio/fopen.c3
-rw-r--r--src/stdio/fputs.c1
-rw-r--r--src/stdio/fputwc.c3
-rw-r--r--src/stdio/fputws.c1
-rw-r--r--src/stdio/fread.c1
-rw-r--r--src/stdio/freopen.c1
-rw-r--r--src/stdio/ftell.c2
-rw-r--r--src/stdio/fwrite.c1
-rw-r--r--src/stdio/getdelim.c3
-rw-r--r--src/stdio/gets.c2
-rw-r--r--src/stdio/getwc.c1
-rw-r--r--src/stdio/getwchar.c1
-rw-r--r--src/stdio/open_memstream.c3
-rw-r--r--src/stdio/open_wmemstream.c4
-rw-r--r--src/stdio/pclose.c3
-rw-r--r--src/stdio/putwc.c1
-rw-r--r--src/stdio/putwchar.c1
-rw-r--r--src/stdio/ungetwc.c4
-rw-r--r--src/stdio/vfprintf.c9
-rw-r--r--src/stdio/vfscanf.c2
-rw-r--r--src/stdio/vfwprintf.c7
-rw-r--r--src/stdio/vsnprintf.c4
-rw-r--r--src/stdio/vswprintf.c5
-rw-r--r--src/stdio/vswscanf.c1
-rw-r--r--src/stdlib/strtol.c3
-rw-r--r--src/stdlib/wcstod.c1
-rw-r--r--src/stdlib/wcstol.c4
41 files changed, 93 insertions, 19 deletions
diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c
index 08251213..f6e331d4 100644
--- a/src/internal/floatscan.c
+++ b/src/internal/floatscan.c
@@ -4,6 +4,7 @@
#include <float.h>
#include <limits.h>
#include <errno.h>
+#include <ctype.h>
#include "shgetc.h"
#include "floatscan.h"
diff --git a/src/internal/intscan.c b/src/internal/intscan.c
index 178cdf0d..69350efa 100644
--- a/src/internal/intscan.c
+++ b/src/internal/intscan.c
@@ -1,5 +1,6 @@
#include <limits.h>
#include <errno.h>
+#include <ctype.h>
#include "shgetc.h"
/* Lookup table for digit values. -1==255>=36 -> invalid */
diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h
index e9045f27..c9d20fac 100644
--- a/src/internal/stdio_impl.h
+++ b/src/internal/stdio_impl.h
@@ -2,23 +2,6 @@
#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"
diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c
index df6ed71d..59690f6d 100644
--- a/src/stdio/__fdopen.c
+++ b/src/stdio/__fdopen.c
@@ -1,4 +1,10 @@
#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)
{
diff --git a/src/stdio/__fopen_rb_ca.c b/src/stdio/__fopen_rb_ca.c
index a1b1b3b6..9202c8ce 100644
--- a/src/stdio/__fopen_rb_ca.c
+++ b/src/stdio/__fopen_rb_ca.c
@@ -1,4 +1,6 @@
#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)
{
diff --git a/src/stdio/__stdio_read.c b/src/stdio/__stdio_read.c
index c99ca9a9..05e56f92 100644
--- a/src/stdio/__stdio_read.c
+++ b/src/stdio/__stdio_read.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <sys/uio.h>
#include <pthread.h>
static void cleanup(void *p)
diff --git a/src/stdio/__stdio_write.c b/src/stdio/__stdio_write.c
index cef7bbdc..e52e91ae 100644
--- a/src/stdio/__stdio_write.c
+++ b/src/stdio/__stdio_write.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <sys/uio.h>
#include <pthread.h>
static void cleanup(void *p)
diff --git a/src/stdio/__stdout_write.c b/src/stdio/__stdout_write.c
index 0cf71236..200fe2c9 100644
--- a/src/stdio/__stdout_write.c
+++ b/src/stdio/__stdout_write.c
@@ -1,4 +1,6 @@
#include "stdio_impl.h"
+#include <termios.h>
+#include <sys/ioctl.h>
size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
{
diff --git a/src/stdio/__string_read.c b/src/stdio/__string_read.c
index de002fc1..7b50a7e1 100644
--- a/src/stdio/__string_read.c
+++ b/src/stdio/__string_read.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <string.h>
size_t __string_read(FILE *f, unsigned char *buf, size_t len)
{
diff --git a/src/stdio/fgetln.c b/src/stdio/fgetln.c
index 06b88837..a2e4bd3c 100644
--- a/src/stdio/fgetln.c
+++ b/src/stdio/fgetln.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <string.h>
char *fgetln(FILE *f, size_t *plen)
{
diff --git a/src/stdio/fgets.c b/src/stdio/fgets.c
index ee0ac30e..b01a4187 100644
--- a/src/stdio/fgets.c
+++ b/src/stdio/fgets.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <string.h>
#define MIN(a,b) ((a)<(b) ? (a) : (b))
diff --git a/src/stdio/fgetwc.c b/src/stdio/fgetwc.c
index 6f9f9ec2..8626d54c 100644
--- a/src/stdio/fgetwc.c
+++ b/src/stdio/fgetwc.c
@@ -1,4 +1,6 @@
#include "stdio_impl.h"
+#include <wchar.h>
+#include <errno.h>
wint_t __fgetwc_unlocked(FILE *f)
{
diff --git a/src/stdio/fgetws.c b/src/stdio/fgetws.c
index fab9bd0f..195cb435 100644
--- a/src/stdio/fgetws.c
+++ b/src/stdio/fgetws.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <wchar.h>
wint_t __fgetwc_unlocked(FILE *);
diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c
index 770fd995..91d52bc1 100644
--- a/src/stdio/fmemopen.c
+++ b/src/stdio/fmemopen.c
@@ -1,4 +1,7 @@
#include "stdio_impl.h"
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
struct cookie {
size_t pos, len, size;
diff --git a/src/stdio/fopen.c b/src/stdio/fopen.c
index c741aede..da17ce8b 100644
--- a/src/stdio/fopen.c
+++ b/src/stdio/fopen.c
@@ -1,4 +1,7 @@
#include "stdio_impl.h"
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
FILE *fopen(const char *restrict filename, const char *restrict mode)
{
diff --git a/src/stdio/fputs.c b/src/stdio/fputs.c
index b41bc8c7..1112b192 100644
--- a/src/stdio/fputs.c
+++ b/src/stdio/fputs.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <string.h>
int fputs(const char *restrict s, FILE *restrict f)
{
diff --git a/src/stdio/fputwc.c b/src/stdio/fputwc.c
index 45ea8c23..7b621dd2 100644
--- a/src/stdio/fputwc.c
+++ b/src/stdio/fputwc.c
@@ -1,4 +1,7 @@
#include "stdio_impl.h"
+#include <wchar.h>
+#include <limits.h>
+#include <ctype.h>
wint_t __fputwc_unlocked(wchar_t c, FILE *f)
{
diff --git a/src/stdio/fputws.c b/src/stdio/fputws.c
index 0b593c08..5723cbcd 100644
--- a/src/stdio/fputws.c
+++ b/src/stdio/fputws.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <wchar.h>
int fputws(const wchar_t *restrict ws, FILE *restrict f)
{
diff --git a/src/stdio/fread.c b/src/stdio/fread.c
index 3f31af8a..c461256c 100644
--- a/src/stdio/fread.c
+++ b/src/stdio/fread.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <string.h>
#define MIN(a,b) ((a)<(b) ? (a) : (b))
diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c
index 7ae116d8..6c1b575f 100644
--- a/src/stdio/freopen.c
+++ b/src/stdio/freopen.c
@@ -1,4 +1,5 @@
#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
diff --git a/src/stdio/ftell.c b/src/stdio/ftell.c
index 3904a1d8..82371e37 100644
--- a/src/stdio/ftell.c
+++ b/src/stdio/ftell.c
@@ -1,4 +1,6 @@
#include "stdio_impl.h"
+#include <limits.h>
+#include <errno.h>
off_t __ftello_unlocked(FILE *f)
{
diff --git a/src/stdio/fwrite.c b/src/stdio/fwrite.c
index 8027b306..d5f6542d 100644
--- a/src/stdio/fwrite.c
+++ b/src/stdio/fwrite.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <string.h>
size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
{
diff --git a/src/stdio/getdelim.c b/src/stdio/getdelim.c
index 5015c3a6..26093a6c 100644
--- a/src/stdio/getdelim.c
+++ b/src/stdio/getdelim.c
@@ -1,4 +1,7 @@
#include "stdio_impl.h"
+#include <string.h>
+#include <inttypes.h>
+#include <errno.h>
#define MIN(a,b) ((a)<(b) ? (a) : (b))
diff --git a/src/stdio/gets.c b/src/stdio/gets.c
index 24319eb2..6c4645e5 100644
--- a/src/stdio/gets.c
+++ b/src/stdio/gets.c
@@ -1,4 +1,6 @@
#include "stdio_impl.h"
+#include <limits.h>
+#include <string.h>
char *gets(char *s)
{
diff --git a/src/stdio/getwc.c b/src/stdio/getwc.c
index a2818bc4..a5008f0e 100644
--- a/src/stdio/getwc.c
+++ b/src/stdio/getwc.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <wchar.h>
wint_t getwc(FILE *f)
{
diff --git a/src/stdio/getwchar.c b/src/stdio/getwchar.c
index 2295bd40..bd89e0ec 100644
--- a/src/stdio/getwchar.c
+++ b/src/stdio/getwchar.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <wchar.h>
wint_t getwchar(void)
{
diff --git a/src/stdio/open_memstream.c b/src/stdio/open_memstream.c
index 687e818d..c7330abe 100644
--- a/src/stdio/open_memstream.c
+++ b/src/stdio/open_memstream.c
@@ -1,4 +1,7 @@
#include "stdio_impl.h"
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
struct cookie {
char **bufp;
diff --git a/src/stdio/open_wmemstream.c b/src/stdio/open_wmemstream.c
index a830b143..2fe504c7 100644
--- a/src/stdio/open_wmemstream.c
+++ b/src/stdio/open_wmemstream.c
@@ -1,4 +1,8 @@
#include "stdio_impl.h"
+#include <wchar.h>
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
struct cookie {
wchar_t **bufp;
diff --git a/src/stdio/pclose.c b/src/stdio/pclose.c
index 7fb76ed4..080a4262 100644
--- a/src/stdio/pclose.c
+++ b/src/stdio/pclose.c
@@ -1,5 +1,6 @@
#include "stdio_impl.h"
-#include "syscall.h"
+#include <errno.h>
+#include <unistd.h>
int pclose(FILE *f)
{
diff --git a/src/stdio/putwc.c b/src/stdio/putwc.c
index 80b54a47..4bb74733 100644
--- a/src/stdio/putwc.c
+++ b/src/stdio/putwc.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <wchar.h>
wint_t putwc(wchar_t c, FILE *f)
{
diff --git a/src/stdio/putwchar.c b/src/stdio/putwchar.c
index 3aacc1cf..b249c4ac 100644
--- a/src/stdio/putwchar.c
+++ b/src/stdio/putwchar.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <wchar.h>
wint_t putwchar(wchar_t c)
{
diff --git a/src/stdio/ungetwc.c b/src/stdio/ungetwc.c
index 5282fee1..8cc85a6b 100644
--- a/src/stdio/ungetwc.c
+++ b/src/stdio/ungetwc.c
@@ -1,4 +1,8 @@
#include "stdio_impl.h"
+#include <wchar.h>
+#include <limits.h>
+#include <ctype.h>
+#include <string.h>
wint_t ungetwc(wint_t c, FILE *f)
{
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 4a2752b2..1e7e6a47 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -1,4 +1,13 @@
#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 */
diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c
index 54d08495..fe071e95 100644
--- a/src/stdio/vfscanf.c
+++ b/src/stdio/vfscanf.c
@@ -1,4 +1,3 @@
-#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
@@ -9,6 +8,7 @@
#include <errno.h>
#include <math.h>
#include <float.h>
+#include <inttypes.h>
#include "stdio_impl.h"
#include "shgetc.h"
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index a42ba195..eb079312 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -1,4 +1,11 @@
#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. */
diff --git a/src/stdio/vsnprintf.c b/src/stdio/vsnprintf.c
index 6f19b028..be2c44eb 100644
--- a/src/stdio/vsnprintf.c
+++ b/src/stdio/vsnprintf.c
@@ -1,4 +1,8 @@
#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)
{
diff --git a/src/stdio/vswprintf.c b/src/stdio/vswprintf.c
index f3d4fec1..7d237bae 100644
--- a/src/stdio/vswprintf.c
+++ b/src/stdio/vswprintf.c
@@ -1,4 +1,9 @@
#include "stdio_impl.h"
+#include <limits.h>
+#include <string.h>
+#include <errno.h>
+#include <stdint.h>
+#include <wchar.h>
struct cookie {
wchar_t *ws;
diff --git a/src/stdio/vswscanf.c b/src/stdio/vswscanf.c
index a205200a..7a2f7c7a 100644
--- a/src/stdio/vswscanf.c
+++ b/src/stdio/vswscanf.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include <wchar.h>
static size_t wstring_read(FILE *f, unsigned char *buf, size_t len)
{
diff --git a/src/stdlib/strtol.c b/src/stdlib/strtol.c
index 23a2f3b6..7ee88794 100644
--- a/src/stdlib/strtol.c
+++ b/src/stdlib/strtol.c
@@ -1,6 +1,9 @@
#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)
{
diff --git a/src/stdlib/wcstod.c b/src/stdlib/wcstod.c
index 03670b0b..83f308d3 100644
--- a/src/stdlib/wcstod.c
+++ b/src/stdlib/wcstod.c
@@ -1,6 +1,7 @@
#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
diff --git a/src/stdlib/wcstol.c b/src/stdlib/wcstol.c
index 3d7c97da..4443f577 100644
--- a/src/stdlib/wcstol.c
+++ b/src/stdlib/wcstol.c
@@ -1,6 +1,10 @@
#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