diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-09-07 04:10:57 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-09-07 04:10:57 +0000 |
commit | edf5b2d7168982e1725f41e142b77e5ec88d7bf2 (patch) | |
tree | d8f99738ad6b0db07f474b26ebb8db432c147056 /stdio-common | |
parent | 474be527c80085dfdc48568f44e1359e5452c47e (diff) | |
download | glibc-edf5b2d7168982e1725f41e142b77e5ec88d7bf2.tar.gz |
update from main archive 960906cvs/libc-960907
Sat Sep 7 05:15:45 1996 Ulrich Drepper <drepper@cygnus.com>
* libio/iofdopen: Initialize _lock field only if _IO_MTSAFE_IO.
* libio/iofopen: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/memstream.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vdprintf.c: Likewise.
* libio/vsnprintf.c: Likewise.
Sat Sep 7 03:55:47 1996 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig (soversions.mk): Also use shlib-versions files
in add-on directories.
* config.make.in (config-defines): Remove. Not used anymore.
(defines): New variable. Initiliazed by @DEFINES@.
* configure.in: Add AC_SUBST(DEFINES).
* libio/Makefile (routines): When compiling reentrant libc add
clearerr_u, feof_u, ferror_u, fputc_u, getc_u, getchar_u,
iofflush_u, putc_u, putchar_u, ioflockfile.
(CPPFLAGS): Add -D_IO_MTSAFE_IO for reentrant libc.
* sysdeps/stub/libc-lock.h: Add stubs for __libc_cleanup_region_start
and __libc_cleanup_region_end.
* sysdeps/unix/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
using __errno_location function.
* sysdeps/unix/sysv/linux/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
using __errno_location function.
(__errno_location): New function.
* sysdeps/unix/sysv/linux/i386/sysdep.h [PIC]: Add second
syscall_error handler for reentrant libc.
* sysdeps/unix/opendir.c: Remove unneeded `;'.
* libio.h [_IO_MTSAFE_IO]: Include <pthread.h>.
[!_IO_MTSAFE_IO]: Define _IO_flockfile and _IO_funlockfile
as empty macros.
* libioP.h: Include <libc-lock.h>.
* libio/stdio.h: Add prototypes for *_locked and *_unlocked
functions.
* libio/clearerr.c: Use _IO_ protected versions of flockfile
and funlockfile to be namespace clean.
* libio/genops.c: Use __libc_lock_* macros for handling lock.
* libio/iofdopen: Add initialization of _lock in _IO_FILE.
* libio/iofopen: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/memstream.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vdprintf.c: Likewise.
* libio/vsnprintf.c: Likewise.
* libio/fgetc.c: Use __libc_cleanup_region_* macros instead
of flockfile etc.
* libio/fputc.c: Likewise.
* libio/freopen.c: Likewise.
* libio/fseek.c: Likewise.
* libio/getc.c: Likewise.
* libio/getchar.c: Likewise.
* libio/iofclose.c: Likewise.
* libio/iofflush.c: Likewise.
* libio/iofgetpos.c: Likewise.
* libio/iofgets.c: Likewise.
* libio/iofputs.c: Likewise.
* libio/iofread.c: Likewise.
* libio/iofsetpos.c: Likewise.
* libio/ioftell.c: Likewise.
* libio/iofwrite.c: Likewise.
* libio/iogetdelim.c: Likewise.
* libio/iogets.c: Likewise.
* libio/ioputs.c: Likewise.
* libio/iosetbuffer.c: Likewise.
* libio/iosetvbuf.c: Likewise.
* libio/ioungetc.c: Likewise.
* libio/putc.c: Likewise.
* libio/putchar.c: Likewise.
* libio/rewind.c: Likewise.
* stdio-common/vfprintf.c: Likewise.
* stdio-common/vfscanf.c: Likewise.
* libio/clearerr_u.c: Correct alias name.
* libio/ferror_u.c: Likewise.
* libio/fileno.c: Likewise.
* libio/fputc_u.c: Likewise.
* libio/getc.c: Likewise.
* libio/getc_u.c: Likewise.
* libio/getchar.c: Likewise.
* libio/getchar_u.c: Likewise.
* libio/putc.c: Likewise.
* libio/putchar.c: Likewise.
* libio/feof_u.c: Undefine macro with name of function before
definition of function itself.
* libio/ioflockfile.c: New file. Implementation of flockfile and
funlockfile.
* libio/putchar_u.c: Fix typo. Use stdout instead of fp.
* malloc/malloc.h: Don't include <libc-lock.h> and don't declare
_malloc_loc.
* malloc/free.c: Include <libc-lock.h>.
* malloc/realloc.c: Likewise.
* malloc/malloc-find.c: Likewise.
* malloc/malloc-size.c: Likewise.
* malloc/malloc-walk.c: Likewise.
* malloc/memalign.c: Likewise.
* malloc/malloc.c: Likewise.
* sysdeps/i386/dl-machine.h: Correct clearing of _dl_starting_up.
Fri Sep 6 19:38:49 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/stub/libc-lock.h: Define __libc_lock_critical_start
and __libc_lock_critical_end as empty macros.
* malloc/malloc.h: Don't include <libc-lock.h> and don't declare
__libc_malloc_lock.
* malloc/free.c: Include <libc-lock.h>.
* malloc/malloc-find.c: Likewise.
* malloc/malloc-size.c: Likewise.
* malloc/malloc-walk.c: Likewise.
* malloc/malloc.c: Likewise.
* malloc/memalign.c: Likewise.
* malloc/realloc.c: Likewise.
* Makefile: Undo change from Mon Sep 2 22:15:14 1996. No more
extra_solibs pass.
* Rules: Likewise.
* extra-lib.mk: Likewise.
* manual/Makefile: Likewise.
* db/Makefile (makedb): Choose dependecies based on build-shared.
Patch by Andres Schwab.
* sysdeps/posix/sysconf.c: Don't use PTHREAD_DESTRUCTOR_ITERATIONS
but _POSIX_THREAD_DESTRUCTOR_ITERATIONS.
* sysdeps/unix/sysv/linux/errnos.h: New file.
* sysdeps/unix/sysv/linux/schedbits.h: New file.
* sysdeps/unix/sysv/linux/waitflags.h: New file.
* sysdeps/unix/sysv/linux/gnu/types.h: Add definition of `key_t'.
Fri Sep 6 08:26:31 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* rpm/template: Fix typo in %build section.
Fri Sep 6 03:31:07 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/errnos.h: Don't define errno macro when
building libc without thread support.
* resolv/netdb.h: Likewise for h_errno macro.
Thu Sep 5 23:01:48 1996 Ulrich Drepper <drepper@cygnus.com>
* libc-symbols.h: Add new macro weak_const_function. It's like
weak_function, but the function is additionally marked as const.
* features.h: Only include <sys/cdefs.h> if !__ASSEMBLER__.
Thu Sep 5 22:55:49 1996 Richard Henderson <rth@tamu.edu>
* inet/herrno.c (__h_errno_location): New function.
(h_errno): Make strong_alias __h_errno so that we can access
the variable even if `h_errno' is a macro.
* resolv/netdb.h: Define macro h_errno to access thread specific
version of h_errno variable. Declare alias __h_errno for h_errno.
* resolv/res_query (h_errno): Remove definition.
* sysdeps/unix/sysv/linux/errnos.h [!__ASSEMBLER__ && __USE_REENTRANT]:
Add macro `errno' to get thread specific variable.
* sysdeps/unix/alpha/sysdep.S [_LIBC_REENTRANT]: Set errno using
__errno_location function.
(__errno_location): New function.
Thu Sep 5 21:08:44 1996 Ulrich Drepper <drepper@cygnus.com>
* posix/gnu/types.h: Remove definition of key_t.
* sysdeps/generic/gnu/types.h: Move it to here.
* sysdeps/unix/sysv/linux/gnu/types.h: Add Linux specific
definition of key_t.
* sysdeps/unix/sysv/linux/waitflags.h: New file. Linux specific
definitions.
* sysdeps/unix/sysv/linux/schedbits.h: New file. Include
clone prototypes and associated flags.
Thu Sep 5 08:58:47 1996 Richard Henderson <rth@tamu.edu>
* sysdeps/alpha/elf/start.S: Make _start global again.
hertz.
here.
Wed Sep 4 16:16:13 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/mach/hurd/send.c (__send): De-ANSI-fy.
* sysdeps/mach/hurd/sendto.c (sendto): Likewise.
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/vfprintf.c | 29 | ||||
-rw-r--r-- | stdio-common/vfscanf.c | 22 |
2 files changed, 34 insertions, 17 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 9a9e583faa..7c6a498a75 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -101,6 +101,9 @@ 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) +/* This macro must be without parameter! Don't change it. */ +# define funlockfile _IO_funlockfile #else /* ! USE_IN_LIBIO */ /* This code is for use in the GNU C library. */ # include <stdio.h> @@ -398,7 +401,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) #define process_arg(fspec) \ - /* Start real work. We know about all flag and modifiers and \ + /* Start real work. We know about all flags and modifiers and \ now process the wanted format specifier. */ \ LABEL (form_percent): \ /* Write a literal "%". */ \ @@ -846,6 +849,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) f = lead_str_end = find_spec (format, &mbstate); /* Lock stream. */ + __libc_cleanup_region_start ((void (*) (void *)) &funlockfile, s); flockfile (s); /* Write the literal text before the first format. */ @@ -854,10 +858,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) /* If we only have to print a simple string, return now. */ if (*f == L_('\0')) - { - funlockfile (s); - return done; - } + goto all_done; /* Process whole format string. */ do @@ -1025,8 +1026,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) if (spec == L_('\0')) { /* The format string ended before the specifier is complete. */ - funlockfile (s); - return -1; + done = -1; + goto all_done; } /* If we are in the fast loop force entering the complicated @@ -1042,11 +1043,8 @@ 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; + /* Unlock stream and return. */ + goto all_done; /* Here starts the more complex loop to handle positional parameters. */ do_positional: @@ -1289,8 +1287,8 @@ do_positional: of chars. */ if (function_done < 0) { - funlockfile (s); - return -1; + done = -1; + goto all_done; } done += function_done; @@ -1305,8 +1303,9 @@ do_positional: } } +all_done: /* Unlock the stream. */ - funlockfile (s); + __libc_cleanup_region_end (1); return done; } diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 41b9f51f08..903f5849cc 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -79,6 +79,10 @@ Cambridge, MA 02139, USA. */ return EOF; \ } \ } while (0) +# define LOCK_STREAM(S) \ + __libc_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, (S)); \ + _IO_flockfile (S) +# define UNLOCK_STREAM __libc_cleanup_region_end (1) #else # define ungetc(c, s) (--read_in, ungetc (c, s)) # define inchar() ((c = getc (s)), (void) ++read_in, c) @@ -105,8 +109,18 @@ Cambridge, MA 02139, USA. */ return EOF; \ } \ } while (0) +#if 1 + /* XXX For now !!! */ # define flockfile(S) /* nothing */ # define funlockfile(S) /* nothing */ +# define LOCK_STREAM(S) +# define UNLOCK_STREAM +#else +# define LOCK_STREAM(S) \ + __libc_cleanup_region_start (&__funlockfile, (S)); \ + __flockfile (S) +# define UNLOCK_STREAM __libc_cleanup_region_start (1) +#endif #endif @@ -194,7 +208,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP); /* Lock the stream. */ - flockfile (s); + LOCK_STREAM (s); /* Run through the format string. */ while (*f != '\0') @@ -441,6 +455,10 @@ __vfscanf (FILE *s, const char *format, va_list argptr) else while (--width > 0 && inchar () != EOF); + if (width > 0) + /* I.e., EOF was read. */ + --read_in; + if (!(flags & SUPPRESS)) ++done; @@ -842,7 +860,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) } /* Unlock stream. */ - funlockfile (s); + UNLOCK_STREAM; return done; } |