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 | |
parent | f0523145cc30a32daa64dd0bd5661b0b204f00da (diff) | |
download | glibc-7c713e287e50dc338779ed1a6c6ac701720a3a41.tar glibc-7c713e287e50dc338779ed1a6c6ac701720a3a41.tar.gz glibc-7c713e287e50dc338779ed1a6c6ac701720a3a41.tar.bz2 glibc-7c713e287e50dc338779ed1a6c6ac701720a3a41.zip |
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')
-rw-r--r-- | stdio-common/_itoa.c | 6 | ||||
-rw-r--r-- | stdio-common/printf_fp.c | 2 | ||||
-rw-r--r-- | stdio-common/vfprintf.c | 38 | ||||
-rw-r--r-- | stdio-common/vfscanf.c | 85 |
4 files changed, 90 insertions, 41 deletions
diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c index f85b15b030..9d77b39005 100644 --- a/stdio-common/_itoa.c +++ b/stdio-common/_itoa.c @@ -260,9 +260,11 @@ _itoa (value, buflim, base, upper_case) Optimize for frequent cases of 32 bit numbers. */ if ((mp_limb_t) (value >> 32) >= 1) { +#if UDIV_TIME > 2 * UMUL_TIME || UDIV_NEEDS_NORMALIZATION int big_normalization_steps = brec->big.normalization_steps; - mp_limb_t big_base_norm = brec->big.base << big_normalization_steps; - + mp_limb_t big_base_norm + = brec->big.base << big_normalization_steps; +#endif if ((mp_limb_t) (value >> 32) >= brec->big.base) { mp_limb_t x1hi, x1lo, r; diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index 237deb99a5..9e14b67509 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -54,7 +54,7 @@ Cambridge, MA 02139, USA. */ /* We use this file GNU C library and GNU I/O library. So make names equal. */ # undef putc -# define putc(c, f) _IO_putc (c, f) +# define putc(c, f) _IO_putc_unlocked (c, f) # define size_t _IO_size_t # define FILE _IO_FILE #else /* ! USE_IN_LIBIO */ 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 = diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index bc7acd60de..4b4dd119ca 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -54,38 +54,59 @@ Cambridge, MA 02139, USA. */ # define va_list _IO_va_list # define ungetc(c, s) _IO_ungetc (c, s) -# define inchar() ((c = _IO_getc (s)), (void) ++read_in, c) -# define conv_error() return ((void) (errp != NULL && (*errp |= 2)), \ - (void) (c == EOF || _IO_ungetc (c, s)), done) - -# define input_error() return ((void) (errp != NULL && (*errp |= 1)), \ - done == 0 ? EOF : done) -# define memory_error() return ((void) (errno = ENOMEM), EOF) -# define ARGCHECK(s, format) \ - do \ - { \ - /* Check file argument for consistence. */ \ - CHECK_FILE (s, -1); \ - if (s->_flags & _IO_NO_READS || format == NULL) \ - { \ - MAYBE_SET_EINVAL; \ - return -1; \ - } \ +# define inchar() ((c = _IO_getc_unlocked (s)), (void) ++read_in, c) +# define conv_error() do { \ + if (errp != NULL) *errp |= 2; \ + if (c != EOF) _IO_ungetc (c, s); \ + _IO_funlockfile (s); \ + return done; \ + } while (0) +# define input_error() do { \ + _IO_funlockfile (s); \ + if (errp != NULL) *errp |= 1; \ + return done ?: EOF; \ + } while (0) +# define memory_error() do { \ + _IO_funlockfile (s); \ + errno = ENOMEM; \ + return EOF; \ + } while (0) +# define ARGCHECK(s, format) \ + do \ + { \ + /* Check file argument for consistence. */ \ + CHECK_FILE (s, EOF); \ + if (s->_flags & _IO_NO_READS || format == NULL) \ + { \ + MAYBE_SET_EINVAL; \ + return EOF; \ + } \ } while (0) #else # define inchar() ((c = getc (s)), (void) ++read_in, c) -# define conv_error() return ((void) ungetc (c, s), done) -# define input_error() return (done == 0 ? EOF : done) -# define memory_error() return ((void) (errno = ENOMEM), EOF) -# define ARGCHECK(s, format) \ - do \ - { \ - /* Check file argument for consistence. */ \ - if (!__validfp (s) || !s->__mode.__read || format == NULL) \ - { \ - errno = EINVAL; \ - return -1; \ - } \ +# define conv_error() do { \ + funlockfile (s); \ + ungetc (c, s); \ + return done; \ + } while (0) +# define input_error() do { \ + funlockfile (s); \ + return done ?: EOF; \ + } while (0) +# define memory_error() do { \ + funlockfile (s); \ + errno = ENOMEM; \ + return EOF; \ + } while (0) +# define ARGCHECK(s, format) \ + do \ + { \ + /* Check file argument for consistence. */ \ + if (!__validfp (s) || !s->__mode.__read || format == NULL) \ + { \ + errno = EINVAL; \ + return EOF; \ + } \ } while (0) #endif @@ -173,6 +194,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr) strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0) thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP); + /* Lock the stream. */ + flockfile (s); + c = inchar (); /* Run through the format string. */ @@ -781,6 +805,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr) while (isspace (c)) (void) inchar (); + /* Unlock stream. */ + funlockfile (s); + return ((void) (c == EOF || ungetc (c, s)), done); } |