Browse Source

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.
rs-1.0
Rich Felker 14 years ago
parent
commit
835f9f950e
  1. 1
      src/internal/floatscan.c
  2. 1
      src/internal/intscan.c
  3. 17
      src/internal/stdio_impl.h
  4. 6
      src/stdio/__fdopen.c
  5. 2
      src/stdio/__fopen_rb_ca.c
  6. 1
      src/stdio/__stdio_read.c
  7. 1
      src/stdio/__stdio_write.c
  8. 2
      src/stdio/__stdout_write.c
  9. 1
      src/stdio/__string_read.c
  10. 1
      src/stdio/fgetln.c
  11. 1
      src/stdio/fgets.c
  12. 2
      src/stdio/fgetwc.c
  13. 1
      src/stdio/fgetws.c
  14. 3
      src/stdio/fmemopen.c
  15. 3
      src/stdio/fopen.c
  16. 1
      src/stdio/fputs.c
  17. 3
      src/stdio/fputwc.c
  18. 1
      src/stdio/fputws.c
  19. 1
      src/stdio/fread.c
  20. 1
      src/stdio/freopen.c
  21. 2
      src/stdio/ftell.c
  22. 1
      src/stdio/fwrite.c
  23. 3
      src/stdio/getdelim.c
  24. 2
      src/stdio/gets.c
  25. 1
      src/stdio/getwc.c
  26. 1
      src/stdio/getwchar.c
  27. 3
      src/stdio/open_memstream.c
  28. 4
      src/stdio/open_wmemstream.c
  29. 3
      src/stdio/pclose.c
  30. 1
      src/stdio/putwc.c
  31. 1
      src/stdio/putwchar.c
  32. 4
      src/stdio/ungetwc.c
  33. 9
      src/stdio/vfprintf.c
  34. 2
      src/stdio/vfscanf.c
  35. 7
      src/stdio/vfwprintf.c
  36. 4
      src/stdio/vsnprintf.c
  37. 5
      src/stdio/vswprintf.c
  38. 1
      src/stdio/vswscanf.c
  39. 3
      src/stdlib/strtol.c
  40. 1
      src/stdlib/wcstod.c
  41. 4
      src/stdlib/wcstol.c

1
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"

1
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 */

17
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"

6
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)
{

2
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)
{

1
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)

1
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)

2
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)
{

1
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)
{

1
src/stdio/fgetln.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <string.h>
char *fgetln(FILE *f, size_t *plen)
{

1
src/stdio/fgets.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <string.h>
#define MIN(a,b) ((a)<(b) ? (a) : (b))

2
src/stdio/fgetwc.c

@ -1,4 +1,6 @@
#include "stdio_impl.h"
#include <wchar.h>
#include <errno.h>
wint_t __fgetwc_unlocked(FILE *f)
{

1
src/stdio/fgetws.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <wchar.h>
wint_t __fgetwc_unlocked(FILE *);

3
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;

3
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)
{

1
src/stdio/fputs.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <string.h>
int fputs(const char *restrict s, FILE *restrict f)
{

3
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)
{

1
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)
{

1
src/stdio/fread.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <string.h>
#define MIN(a,b) ((a)<(b) ? (a) : (b))

1
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

2
src/stdio/ftell.c

@ -1,4 +1,6 @@
#include "stdio_impl.h"
#include <limits.h>
#include <errno.h>
off_t __ftello_unlocked(FILE *f)
{

1
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)
{

3
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))

2
src/stdio/gets.c

@ -1,4 +1,6 @@
#include "stdio_impl.h"
#include <limits.h>
#include <string.h>
char *gets(char *s)
{

1
src/stdio/getwc.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <wchar.h>
wint_t getwc(FILE *f)
{

1
src/stdio/getwchar.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <wchar.h>
wint_t getwchar(void)
{

3
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;

4
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;

3
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)
{

1
src/stdio/putwc.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <wchar.h>
wint_t putwc(wchar_t c, FILE *f)
{

1
src/stdio/putwchar.c

@ -1,4 +1,5 @@
#include "stdio_impl.h"
#include <wchar.h>
wint_t putwchar(wchar_t c)
{

4
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)
{

9
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 */

2
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"

7
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. */

4
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)
{

5
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;

1
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)
{

3
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)
{

1
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

4
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

Loading…
Cancel
Save