diff options
author | Roland McGrath <roland@gnu.org> | 1996-05-09 00:37:21 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-05-09 00:37:21 +0000 |
commit | 7c713e287e50dc338779ed1a6c6ac701720a3a41 (patch) | |
tree | 00dc9bb790eef870a0624a5813120cc3971b16ff /stdio-common/vfprintf.c | |
parent | f0523145cc30a32daa64dd0bd5661b0b204f00da (diff) | |
download | glibc-7c713e287e50dc338779ed1a6c6ac701720a3a41.tar.gz |
Wed May 8 20:04:29 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* Rules (subdir_install): Depend on $(common-objpfx)sor-$(subdir).
[! libc.so-version]: Clear static-only-routines.
($(common-objpfx)sor-$(subdir)): New target.
[static-only-routines]: New static pattern rule for these .so's.
* Makerules [libc.so-version] ($(slibdir)/libc.so): Target removed.
[libc.so-version] ($(libdir)/libc.so, $(common-objpfx)libc-syms.so):
New targets replace it.
(install) [libc.so-version]: Depend on $(libdir)/libc.so instead of
$(slibdir)/libc.so.
* io/Makefile (static-only-routines): New variable.
* configure.in: Check for tools objdump and objcopy, and for awk.
* config.make.in (OBJDUMP, OBJCOPY, AWK): New variables.
Thu May 9 01:24:00 1996 Ulrich Drepper <drepper@cygnus.com>
* locale/programs/config.h: Remove definition of wint_t.
* locale/programs/ld-collate.c: Include <wchar.h> instead of
<wcstr.h>.
* manual/time.texi: Add some more description for %U and %W
format of strftime. Describe new format %V of strftime.
* resolv/gethnamaddr.c: Prevent warning by preventing variable
definition.
* stdio-common/_itoa.c: Ditto.
Tue May 7 23:43:07 1996 Ulrich Drepper <drepper@cygnus.com>
* libio/clearerr.c, libio/feof.c, libio/ferror.c, libio/fgetc.c,
libio/fileno.c, libio/fputc.c, libio/freopen.c, libio/fseek.c,
libio/genops.c, libio/getc.c, libio/getchar.c, libio/iofclose.c,
libio/iofflush.c, libio/iofgetpos.c, libio/iofgets.c,
libio/iofputs.c, libio/iofread.c, libio/iofsetpos.c,
libio/ioftell.c, libio/iofwrite.c, libio/iogetdelim.c,
libio/iogets.c, libio/ioputs.c, libio/iosetbuffer.c,
libio/iosetvbuf.c, libio/ioungetc.c, libio/iovsprintf.c,
libio/libio.h, libio/putc.c, libio/putchar.c, libio/rewind.c,
libio/stdio.h, stdio-common/printf_fp.c, stdio-common/vfprintf.c,
stdio-common/vfscanf.c: Prepare for reentrent libio.
* libio/clearerr_u.c, libio/feof_u.c, libio/ferror_u.c,
libio/fputc_u.c, libio/getc_u.c, libio/getchar_u.c,
libio/iofflush_u.c, libio/putc_u.c, libio/putchar_u.c: New files.
Used in reentrent libio.
* misc/getusershell.c: Prevent warnings.
Diffstat (limited to 'stdio-common/vfprintf.c')
-rw-r--r-- | stdio-common/vfprintf.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 9b24574558..cde7496585 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -62,14 +62,14 @@ ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); # define ISDIGIT(Ch) iswdigit (Ch) # ifdef USE_IN_LIBIO -# define PUT(F, S, N) _IO_sputn (F, S, N) -# define PAD(Padchar) \ +# define PUT(F, S, N) _IO_sputn (F, S, N) +# define PAD(Padchar) \ if (width > 0) \ done += _IO_wpadn (s, Padchar, width) # else # define PUTC(C, F) wputc (C, F) ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n)); -# define PAD(Padchar) \ +# define PAD(Padchar) \ if (width > 0) \ { if (__wprintf_pad (s, Padchar, width) == -1) \ return -1; else done += width; } @@ -83,7 +83,7 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n)); #ifdef USE_IN_LIBIO /* This code is for use in libio. */ # include <libioP.h> -# define PUTC(C, F) _IO_putc (C, F) +# define PUTC(C, F) _IO_putc_unlocked (C, F) # define vfprintf _IO_vfprintf # define size_t _IO_size_t # define FILE _IO_FILE @@ -102,6 +102,8 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n)); } \ } while (0) # define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED) +# define flockfile(S) _IO_flockfile (S) +# define fUNlockfile(S) _IO_funlockfile (S) #else /* ! USE_IN_LIBIO */ /* This code is for use in the GNU C library. */ # include <stdio.h> @@ -801,13 +803,19 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) /* Find the first format specifier. */ f = lead_str_end = find_spec (format, &mbstate); + /* Lock stream. */ + flockfile (s); + /* Write the literal text before the first format. */ outstring ((const UCHAR_T *) format, lead_str_end - (const UCHAR_T *) format); /* If we only have to print a simple string, return now. */ if (*f == L_('\0')) - return done; + { + funlockfile (s); + return done; + } /* Process whole format string. */ do @@ -972,8 +980,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) LABEL (form_unknown): if (spec == L_('\0')) - /* The format string ended before the specifier is complete. */ - return -1; + { + /* The format string ended before the specifier is complete. */ + funlockfile (s); + return -1; + } /* If we are in the fast loop force entering the complicated one. */ @@ -988,6 +999,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) } while (*f != L_('\0')); + /* Unlock stream. */ + funlockfile (s); + /* We processed the whole format without any positional parameters. */ return done; @@ -1230,7 +1244,10 @@ do_positional: /* If an error occured we don't have information about # of chars. */ if (function_done < 0) - return -1; + { + funlockfile (s); + return -1; + } done += function_done; } @@ -1244,6 +1261,9 @@ do_positional: } } + /* Unlock the stream. */ + funlockfile (s); + return done; } @@ -1378,7 +1398,7 @@ _IO_helper_overflow (_IO_FILE *s, int c) _IO_size_t written = _IO_sputn (target, s->_IO_write_base, used); s->_IO_write_ptr -= written; } - return _IO_putc (c, s); + return PUTC (c, s); } static const struct _IO_jump_t _IO_helper_jumps = |