summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
committerManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
commit082e680bd54e999f2bb4eb77141958938b1e9ee9 (patch)
tree203c45b85ca608e1550d8ffc459456fc9cf0b30b
parent17c21765b4a97c6f0b74ba8466073e5a3f97cdee (diff)
New stdio core. Should be more maintainable. Fixes a couple of bugs.
Codepaths streamlined. Improved performance for nonthreaded apps when linked with a thread-enabled libc. Minor iconv bug and some locale/thread related startup issues fixed. These showed up in getting a gcj-compiled java helloworld app running. Removed some old extension functions... _stdio_fdout and _stdio_fsfopen.
-rw-r--r--include/stdio.h69
-rw-r--r--include/wchar.h4
-rw-r--r--libc/inet/addr.c3
-rw-r--r--libc/misc/assert/__assert.c33
-rw-r--r--libc/misc/locale/locale.c4
-rw-r--r--libc/misc/time/time.c2
-rw-r--r--libc/misc/wchar/Makefile18
-rw-r--r--libc/misc/wchar/wchar.c41
-rw-r--r--libc/misc/wchar/wstdio.c14
-rw-r--r--libc/pwd_grp/pwd_grp.c15
-rw-r--r--libc/stdio/Makefile144
-rw-r--r--libc/stdio/_READ.c66
-rw-r--r--libc/stdio/_WRITE.c100
-rw-r--r--libc/stdio/__fbufsize.c20
-rw-r--r--libc/stdio/__flbf.c20
-rw-r--r--libc/stdio/__fpending.c35
-rw-r--r--libc/stdio/__fpurge.c34
-rw-r--r--libc/stdio/__freadable.c20
-rw-r--r--libc/stdio/__freading.c20
-rw-r--r--libc/stdio/__fsetlocking.c45
-rw-r--r--libc/stdio/__fwritable.c20
-rw-r--r--libc/stdio/__fwriting.c20
-rw-r--r--libc/stdio/_adjust_pos.c68
-rw-r--r--libc/stdio/_cs_funcs.c67
-rw-r--r--libc/stdio/_flushlbf.c18
-rw-r--r--libc/stdio/_fopen.c207
-rw-r--r--libc/stdio/_fpmaxtostr.c738
-rw-r--r--libc/stdio/_fwrite.c78
-rw-r--r--libc/stdio/_load_inttype.c66
-rw-r--r--libc/stdio/_rfill.c45
-rw-r--r--libc/stdio/_stdio.c432
-rw-r--r--libc/stdio/_stdio.h436
-rw-r--r--libc/stdio/_store_inttype.c57
-rw-r--r--libc/stdio/_trans2r.c75
-rw-r--r--libc/stdio/_trans2w.c89
-rw-r--r--libc/stdio/_uintmaxtostr.c151
-rw-r--r--libc/stdio/_wcommit.c31
-rw-r--r--libc/stdio/_wfwrite.c75
-rw-r--r--libc/stdio/asprintf.c29
-rw-r--r--libc/stdio/clearerr.c39
-rw-r--r--libc/stdio/ctermid.c54
-rw-r--r--libc/stdio/dprintf.c21
-rw-r--r--libc/stdio/fclose.c86
-rw-r--r--libc/stdio/fcloseall.c40
-rw-r--r--libc/stdio/fdopen.c17
-rw-r--r--libc/stdio/feof.c42
-rw-r--r--libc/stdio/ferror.c42
-rw-r--r--libc/stdio/fflush.c161
-rw-r--r--libc/stdio/fgetc.c98
-rw-r--r--libc/stdio/fgetpos.c44
-rw-r--r--libc/stdio/fgets.c84
-rw-r--r--libc/stdio/fgetwc.c134
-rw-r--r--libc/stdio/fgetws.c61
-rw-r--r--libc/stdio/fileno.c45
-rw-r--r--libc/stdio/flockfile.c16
-rw-r--r--libc/stdio/fmemopen.c176
-rw-r--r--libc/stdio/fopen.c24
-rw-r--r--libc/stdio/fopencookie.c59
-rw-r--r--libc/stdio/fprintf.c21
-rw-r--r--libc/stdio/fputc.c96
-rw-r--r--libc/stdio/fputs.c46
-rw-r--r--libc/stdio/fputwc.c42
-rw-r--r--libc/stdio/fputws.c44
-rw-r--r--libc/stdio/fread.c108
-rw-r--r--libc/stdio/freopen.c66
-rw-r--r--libc/stdio/fseeko.c89
-rw-r--r--libc/stdio/fsetpos.c44
-rw-r--r--libc/stdio/ftello.c61
-rw-r--r--libc/stdio/ftrylockfile.c19
-rw-r--r--libc/stdio/funlockfile.c15
-rw-r--r--libc/stdio/fwide.c32
-rw-r--r--libc/stdio/fwprintf.c22
-rw-r--r--libc/stdio/fwrite.c59
-rw-r--r--libc/stdio/getchar.c44
-rw-r--r--libc/stdio/getdelim.c124
-rw-r--r--libc/stdio/getline.c34
-rw-r--r--libc/stdio/gets.c36
-rw-r--r--libc/stdio/getw.c18
-rw-r--r--libc/stdio/getwchar.c31
-rw-r--r--libc/stdio/old_vfprintf.c54
-rw-r--r--libc/stdio/open_memstream.c162
-rw-r--r--libc/stdio/perror.c36
-rw-r--r--libc/stdio/popen.c21
-rw-r--r--libc/stdio/printf.c3259
-rw-r--r--libc/stdio/putchar.c44
-rw-r--r--libc/stdio/puts.c33
-rw-r--r--libc/stdio/putw.c28
-rw-r--r--libc/stdio/putwchar.c31
-rw-r--r--libc/stdio/remove.c29
-rw-r--r--libc/stdio/rewind.c20
-rw-r--r--libc/stdio/scanf.c227
-rw-r--r--libc/stdio/setbuf.c15
-rw-r--r--libc/stdio/setbuffer.c21
-rw-r--r--libc/stdio/setlinebuf.c20
-rw-r--r--libc/stdio/setvbuf.c106
-rw-r--r--libc/stdio/snprintf.c27
-rw-r--r--libc/stdio/sprintf.c27
-rw-r--r--libc/stdio/stdio.c3677
-rw-r--r--libc/stdio/swprintf.c29
-rw-r--r--libc/stdio/ungetc.c77
-rw-r--r--libc/stdio/ungetwc.c48
-rw-r--r--libc/stdio/vasprintf.c75
-rw-r--r--libc/stdio/vdprintf.c62
-rw-r--r--libc/stdio/vfprintf.c1901
-rw-r--r--libc/stdio/vprintf.c14
-rw-r--r--libc/stdio/vsnprintf.c210
-rw-r--r--libc/stdio/vsprintf.c21
-rw-r--r--libc/stdio/vswprintf.c70
-rw-r--r--libc/stdio/vwprintf.c15
-rw-r--r--libc/stdio/wprintf.c23
-rw-r--r--libc/stdlib/abort.c8
-rw-r--r--libc/stdlib/ptsname.c3
-rw-r--r--libc/stdlib/stdlib.c10
-rw-r--r--libc/string/wstring.c9
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_locale.h1
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_stdio.h716
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h115
-rw-r--r--libpthread/linuxthreads/lockfile.c29
-rw-r--r--libpthread/linuxthreads/pthread.c15
119 files changed, 9224 insertions, 7767 deletions
diff --git a/include/stdio.h b/include/stdio.h
index bc8e40b2c..979e4eeb2 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -42,7 +42,7 @@ __BEGIN_DECLS
#if !defined __FILE_defined && defined __need_FILE
/* The opaque type of streams. This is the definition used elsewhere. */
-typedef struct _UC_FILE FILE;
+typedef struct __STDIO_FILE_STRUCT FILE;
# define __FILE_defined 1
#endif /* FILE not defined. */
@@ -52,7 +52,7 @@ typedef struct _UC_FILE FILE;
#if !defined ____FILE_defined && defined __need___FILE
/* The opaque type of streams. This is the definition used elsewhere. */
-typedef struct _UC_FILE __FILE;
+typedef struct __STDIO_FILE_STRUCT __FILE;
# define ____FILE_defined 1
#endif /* __FILE not defined. */
@@ -62,8 +62,6 @@ typedef struct _UC_FILE __FILE;
#ifdef _STDIO_H
#undef _STDIO_USES_IOSTREAM
-#include <sys/types.h>
-
#include <bits/uClibc_stdio.h>
/* This define avoids name pollution if we're using GNU stdarg.h */
@@ -72,23 +70,23 @@ typedef struct _UC_FILE __FILE;
/* The type of the second argument to `fgetpos' and `fsetpos'. */
#ifndef __USE_FILE_OFFSET64
-typedef _UC_fpos_t fpos_t;
+typedef __STDIO_fpos_t fpos_t;
#else
-typedef _UC_fpos64_t fpos_t;
+typedef __STDIO_fpos64_t fpos_t;
#endif
#ifdef __USE_LARGEFILE64
-typedef _UC_fpos64_t fpos64_t;
+typedef __STDIO_fpos64_t fpos64_t;
#endif
/* The possibilities for the third argument to `setvbuf'. */
-#define _IOFBF _UC_IOFBF /* Fully buffered. */
-#define _IOLBF _UC_IOLBF /* Line buffered. */
-#define _IONBF _UC_IONBF /* No buffering. */
+#define _IOFBF __STDIO_IOFBF /* Fully buffered. */
+#define _IOLBF __STDIO_IOLBF /* Line buffered. */
+#define _IONBF __STDIO_IONBF /* No buffering. */
/* Default buffer size. */
#ifndef BUFSIZ
-# define BUFSIZ _UC_BUFSIZ
+# define BUFSIZ __STDIO_BUFSIZ
#endif
@@ -125,9 +123,9 @@ typedef _UC_fpos64_t fpos64_t;
/* Standard streams. */
-extern FILE *stdin; /* Standard input stream. */
-extern FILE *stdout; /* Standard output stream. */
-extern FILE *stderr; /* Standard error output stream. */
+extern FILE *stdin; /* Standard input stream. */
+extern FILE *stdout; /* Standard output stream. */
+extern FILE *stderr; /* Standard error output stream. */
#ifdef __STDC__
/* C89/C99 say they're macros. Make them happy. */
#define stdin stdin
@@ -229,7 +227,7 @@ extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
#endif
#ifdef __USE_GNU
-#ifdef __STDIO_GLIBC_CUSTOM_STREAMS
+#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
/* Create a new stream that refers to the given magic cookie,
and uses the given functions for input and output. */
extern FILE *fopencookie (void *__restrict __magic_cookie,
@@ -355,11 +353,7 @@ extern int getchar (void) __THROW;
/* The C standard explicitly says this is a macro, so we always do the
optimization for it. */
-#ifdef __UCLIBC_HAS_THREADS__
-#define getc(_fp) (getc)(_fp) /* SUSv3 says getc must be threadsafe. */
-#else /* __UCLIBC_HAS_THREADS__ */
#define getc(_fp) __GETC(_fp)
-#endif /* __UCLIBC_HAS_THREADS__ */
#if defined __USE_POSIX || defined __USE_MISC
/* These are defined in POSIX.1:1996. */
@@ -367,7 +361,7 @@ extern int getc_unlocked (FILE *__stream) __THROW;
extern int getchar_unlocked (void) __THROW;
/* SUSv3 allows getc_unlocked to be a macro */
-#define getc_unlocked(_fp) __GETC(_fp)
+#define getc_unlocked(_fp) __GETC_UNLOCKED(_fp)
#endif /* Use POSIX or MISC. */
#ifdef __USE_MISC
@@ -385,11 +379,7 @@ extern int putchar (int __c) __THROW;
/* The C standard explicitly says this can be a macro,
so we always do the optimization for it. */
-#ifdef __UCLIBC_HAS_THREADS__
-#define putc(_ch, _fp) (putc)(_ch, _fp) /* SUSv3 says putc must be threadsafe. */
-#else /* __UCLIBC_HAS_THREADS__ */
#define putc(_ch, _fp) __PUTC(_ch, _fp)
-#endif /* __UCLIBC_HAS_THREADS__ */
#ifdef __USE_MISC
/* Faster version when locking is not necessary. */
@@ -402,7 +392,7 @@ extern int putc_unlocked (int __c, FILE *__stream) __THROW;
extern int putchar_unlocked (int __c) __THROW;
/* SUSv3 allows putc_unlocked to be a macro */
-#define putc_unlocked(_ch, _fp) __PUTC(_ch, _fp)
+#define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp)
#endif /* Use POSIX or MISC. */
@@ -645,6 +635,35 @@ extern void funlockfile (FILE *__stream) __THROW;
#if 0
/* #ifdef __USE_EXTERN_INLINES */
# include <bits/stdio.h>
+#elif 1
+
+#define fgetc(_fp) __FGETC(_fp)
+#define fputc(_ch, _fp) __FPUTC(_ch, _fp)
+
+#ifdef __USE_MISC
+#define fgetc_unlocked(_fp) __FGETC_UNLOCKED(_fp)
+#define fputc_unlocked(_ch, _fp) __FPUTC_UNLOCKED(_ch, _fp)
+#endif
+
+#define getchar() __GETC(__stdin)