diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-07-09 16:47:01 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-07-09 16:47:01 +0000 |
commit | 62a21af8006ab04282fdc354c5b4dc765f56d058 (patch) | |
tree | 568761d58289238aa14cced3f0010809d4d28c00 /libc/stdio/vdprintf.c | |
parent | ef250238dc1572caf859c2b64652f9cdfb0d9e42 (diff) | |
download | uClibc-alpine-62a21af8006ab04282fdc354c5b4dc765f56d058.tar.bz2 uClibc-alpine-62a21af8006ab04282fdc354c5b4dc765f56d058.tar.xz |
BIG BIG commit: all left files merged from trunk [rev 22714]. Currenntly NPTL sh4 port build and work fine. All committed to allow Khem Ray working on a working branch to integrate the ARM nptl port. MIPS nptl port not tested but should still building and working fine. There are some other part non yet merged with trunk (misc/internals and some headers file that need some more work). Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/stdio/vdprintf.c')
-rw-r--r-- | libc/stdio/vdprintf.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c index 67adf47be..de54a5c7d 100644 --- a/libc/stdio/vdprintf.c +++ b/libc/stdio/vdprintf.c @@ -11,7 +11,9 @@ #include "_stdio.h" #include <stdarg.h> +#ifdef __USE_OLD_VFPRINTF__ libc_hidden_proto(vfprintf) +#endif libc_hidden_proto(fflush_unlocked) libc_hidden_proto(vdprintf) @@ -22,8 +24,8 @@ int vdprintf(int filedes, const char * __restrict format, va_list arg) #ifdef __STDIO_BUFFERS char buf[64]; /* TODO: provide _optional_ buffering? */ - f.__bufend = buf + sizeof(buf); - f.__bufstart = buf; + f.__bufend = (unsigned char *) buf + sizeof(buf); + f.__bufstart = (unsigned char *) buf; __STDIO_STREAM_DISABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); __STDIO_STREAM_INIT_BUFREAD_BUFPOS(&f); @@ -48,17 +50,19 @@ int vdprintf(int filedes, const char * __restrict format, va_list arg) __INIT_MBSTATE(&(f.__state)); #endif /* __STDIO_MBSTATE */ -#ifdef __UCLIBC_HAS_THREADS__ +/* _vfprintf_internal doesn't do any locking, locking init is here + * only because of fflush_unlocked. TODO? */ +#if (defined(__STDIO_BUFFERS) || defined(__USE_OLD_VFPRINTF__)) && defined(__UCLIBC_HAS_THREADS__) f.__user_locking = 1; /* Set user locking. */ -#ifdef __USE_STDIO_FUTEXES__ - _IO_lock_init (f._lock); -#else - __stdio_init_mutex(&f.__lock); -#endif + STDIO_INIT_MUTEX(f.__lock); #endif f.__nextopen = NULL; +#ifdef __USE_OLD_VFPRINTF__ rv = vfprintf(&f, format, arg); +#else + rv = _vfprintf_internal(&f, format, arg); +#endif #ifdef __STDIO_BUFFERS /* If not buffering, then fflush is unnecessary. */ |