diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-19 00:37:59 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-19 00:37:59 +0000 |
commit | 14c3586351fdf3e123b000f95a1e83314f78babb (patch) | |
tree | a88a6bfd8d809ab0b8e9ca70a2e63e932ddfa53d /stdio-common | |
parent | 439ff07be06e9354151f984c7d0d2fb05917e8be (diff) | |
download | glibc-14c3586351fdf3e123b000f95a1e83314f78babb.zip glibc-14c3586351fdf3e123b000f95a1e83314f78babb.tar.gz glibc-14c3586351fdf3e123b000f95a1e83314f78babb.tar.bz2 |
Update.
2004-03-18 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Remove hwcap
variable and weak_extern for _dl_hwcap.
(_DL_HWCAP_TLS_MASK): Define.
(HWCAP_CHECK): Fix checking of non-platform hwcap bits. Use
lib->osversion instead of cache_new->libs[middle].osversion.
* stdio-common/asprintf.c: Remove USE_IN_LIBIO conditionals.
* stdio-common/dprintf.c: Likewise.
* stdio-common/fprintf.c: Likewise.
* stdio-common/getline.c: Likewise.
* stdio-common/getw.c: Likewise.
* stdio-common/perror.c: Likewise.
* stdio-common/printf-prs.c: Likewise.
* stdio-common/printf.c: Likewise.
* stdio-common/printf_size.c: Likewise.
* stdio-common/psignal.c: Likewise.
* stdio-common/putw.c: Likewise.
* stdio-common/scanf.c: Likewise.
* stdio-common/snprintf.c: Likewise.
* stdio-common/sprintf.c: Likewise.
* stdio-common/sscanf.c: Likewise.
* stdio-common/tstgetln.c: Likewise.
* stdio-common/vfprintf.c: Likewise.
2004-03-18 Paul Eggert <eggert@cs.ucla.edu>
* posix/getopt.h (__GNUC_PREREQ) [!defined __THROW]: Define
if not defined, fixing a typo (it used to be defined if
__GNUC__ was not defined).
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/asprintf.c | 9 | ||||
-rw-r--r-- | stdio-common/dprintf.c | 8 | ||||
-rw-r--r-- | stdio-common/fprintf.c | 4 | ||||
-rw-r--r-- | stdio-common/getline.c | 13 | ||||
-rw-r--r-- | stdio-common/getw.c | 8 | ||||
-rw-r--r-- | stdio-common/perror.c | 8 | ||||
-rw-r--r-- | stdio-common/printf-prs.c | 25 | ||||
-rw-r--r-- | stdio-common/printf.c | 7 | ||||
-rw-r--r-- | stdio-common/printf_size.c | 26 | ||||
-rw-r--r-- | stdio-common/psignal.c | 11 | ||||
-rw-r--r-- | stdio-common/putw.c | 9 | ||||
-rw-r--r-- | stdio-common/scanf.c | 11 | ||||
-rw-r--r-- | stdio-common/snprintf.c | 8 | ||||
-rw-r--r-- | stdio-common/sprintf.c | 12 | ||||
-rw-r--r-- | stdio-common/sscanf.c | 14 | ||||
-rw-r--r-- | stdio-common/tstgetln.c | 10 | ||||
-rw-r--r-- | stdio-common/vfprintf.c | 235 |
17 files changed, 111 insertions, 307 deletions
diff --git a/stdio-common/asprintf.c b/stdio-common/asprintf.c index 3b211d6..2c466d2 100644 --- a/stdio-common/asprintf.c +++ b/stdio-common/asprintf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,10 +20,8 @@ #include <stdarg.h> #include <stdio.h> -#ifdef USE_IN_LIBIO -# include <libio/libioP.h> -# define vasprintf(s, f, a) _IO_vasprintf (s, f, a) -#endif +#include <libio/libioP.h> +#define vasprintf(s, f, a) _IO_vasprintf (s, f, a) #undef __asprintf /* Write formatted output from FORMAT to a string which is diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c index 534b3f0..b362e5f 100644 --- a/stdio-common/dprintf.c +++ b/stdio-common/dprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,95,97,98,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991,95,97,98,2002,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,10 +19,8 @@ #include <stdarg.h> #include <stdio.h> -#ifdef USE_IN_LIBIO -# include <libio/libioP.h> -# define vdprintf(d, f, a) _IO_vdprintf (d, f, a) -#endif +#include <libio/libioP.h> +#define vdprintf(d, f, a) _IO_vdprintf (d, f, a) /* Write formatted output to D, according to the format string FORMAT. */ /* VARARGS2 */ diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c index 9243a4e..0b99fc8 100644 --- a/stdio-common/fprintf.c +++ b/stdio-common/fprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,97,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991,97,2002,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,9 +36,7 @@ fprintf (FILE *stream, const char *format, ...) } libc_hidden_def (fprintf) -#ifdef USE_IN_LIBIO /* We define the function with the real name here. But deep down in libio the original function _IO_fprintf is also needed. So make an alias. */ weak_alias (fprintf, _IO_fprintf) -#endif diff --git a/stdio-common/getline.c b/stdio-common/getline.c index 4acb41d..198983c 100644 --- a/stdio-common/getline.c +++ b/stdio-common/getline.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,12 +22,10 @@ #undef __getline -#ifdef USE_IN_LIBIO -# include "../libio/libioP.h" -# undef ssize_t -# define ssize_t _IO_ssize_t -# define __getdelim _IO_getdelim -#endif +#include "../libio/libioP.h" +#undef ssize_t +#define ssize_t _IO_ssize_t +#define __getdelim _IO_getdelim /* Like getdelim, but always looks for a newline. */ ssize_t diff --git a/stdio-common/getw.c b/stdio-common/getw.c index 81156e6..423da40 100644 --- a/stdio-common/getw.c +++ b/stdio-common/getw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 1998, 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,10 +18,8 @@ #include <stdio.h> -#ifdef USE_IN_LIBIO -# include <libio/iolibio.h> -# define fread(p, m, n, s) INTUSE(_IO_fread) (p, m, n, s) -#endif +#include <libio/iolibio.h> +#define fread(p, m, n, s) INTUSE(_IO_fread) (p, m, n, s) /* Read a word (int) from STREAM. */ int diff --git a/stdio-common/perror.c b/stdio-common/perror.c index 8db3ca4..f075137 100644 --- a/stdio-common/perror.c +++ b/stdio-common/perror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993,1997,1998,2000-2003 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993,1997,1998,2000-2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ #include <string.h> #include <unistd.h> #include <wchar.h> -#ifdef USE_IN_LIBIO -# include "libioP.h" -#endif +#include "libioP.h" static void perror_internal (FILE *fp, const char *s, int errnum) @@ -39,11 +37,9 @@ perror_internal (FILE *fp, const char *s, int errnum) errstring = __strerror_r (errnum, buf, sizeof buf); -#ifdef USE_IN_LIBIO if (_IO_fwide (fp, 0) > 0) (void) __fwprintf (fp, L"%s%s%s\n", s, colon, errstring); else -#endif (void) fprintf (fp, "%s%s%s\n", s, colon, errstring); } diff --git a/stdio-common/printf-prs.c b/stdio-common/printf-prs.c index 7aef42d..f3b27d6 100644 --- a/stdio-common/printf-prs.c +++ b/stdio-common/printf-prs.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,92,95,96,99,2000,2002,2003 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996, 1999, 2000, 2002, 2003, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,19 +35,10 @@ # define ISASCII(Ch) isascii (Ch) # define MBRLEN(Cp, L, St) __mbrlen (Cp, L, St) -# ifdef USE_IN_LIBIO -# define PUT(F, S, N) _IO_sputn (F, S, N) -# define PAD(Padchar) \ - if (width > 0) \ - done += INTUSE(_IO_padn) (s, Padchar, width) -# else -# define PUTC(C, F) putc (C, F) -ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); +# define PUT(F, S, N) _IO_sputn (F, S, N) # define PAD(Padchar) \ if (width > 0) \ - { if (__printf_pad (s, Padchar, width) == -1) \ - return -1; else done += width; } -# endif + done += INTUSE(_IO_padn) (s, Padchar, width) #else # define vfprintf vfwprintf # define CHAR_T wchar_t @@ -55,19 +47,10 @@ ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); # define L_(Str) L##Str # define ISDIGIT(Ch) iswdigit (Ch) -# ifdef USE_IN_LIBIO # 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) \ - if (width > 0) \ - { if (__wprintf_pad (s, Padchar, width) == -1) \ - return -1; else done += width; } -# endif #endif #define DONT_NEED_READ_INT diff --git a/stdio-common/printf.c b/stdio-common/printf.c index fa013bb..e28c583 100644 --- a/stdio-common/printf.c +++ b/stdio-common/printf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,8 +37,6 @@ printf (const char *format, ...) return done; } -#ifdef USE_IN_LIBIO -# undef _IO_printf +#undef _IO_printf /* This is for libg++. */ strong_alias (printf, _IO_printf); -#endif diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c index d4cbdbf..3c7ac35 100644 --- a/stdio-common/printf_size.c +++ b/stdio-common/printf_size.c @@ -23,30 +23,20 @@ #include <ieee754.h> #include <math.h> #include <printf.h> -#ifdef USE_IN_LIBIO -# include <libioP.h> -#else -# include <stdio.h> -#endif +#include <libioP.h> /* This defines make it possible to use the same code for GNU C library and the GNU I/O library. */ -#ifdef USE_IN_LIBIO -# define PUT(f, s, n) _IO_sputn (f, s, n) -# define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n)) +#define PUT(f, s, n) _IO_sputn (f, s, n) +#define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n)) /* We use this file GNU C library and GNU I/O library. So make names equal. */ -# undef putc -# define putc(c, f) (wide \ - ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f)) -# define size_t _IO_size_t -# define FILE _IO_FILE -#else /* ! USE_IN_LIBIO */ -# define PUT(f, s, n) fwrite (s, 1, n, f) -# define PAD(f, c, n) __printf_pad (f, c, n) -ssize_t __printf_pad __P ((FILE *, char pad, int n)); /* In vfprintf.c. */ -#endif /* USE_IN_LIBIO */ +#undef putc +#define putc(c, f) (wide \ + ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f)) +#define size_t _IO_size_t +#define FILE _IO_FILE /* Macros for doing the actual output. */ diff --git a/stdio-common/psignal.c b/stdio-common/psignal.c index c756394..0764af5 100644 --- a/stdio-common/psignal.c +++ b/stdio-common/psignal.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,1992,1995-1997,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2001, 2002, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,9 +21,7 @@ #include <signal.h> #include <stdlib.h> #include <libintl.h> -#ifdef USE_IN_LIBIO -# include <wchar.h> -#endif +#include <wchar.h> #ifndef HAVE_GNU_LD @@ -49,11 +48,9 @@ psignal (int sig, const char *s) if (sig >= 0 && sig < NSIG && (desc = INTUSE(_sys_siglist)[sig]) != NULL) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) (void) __fwprintf (stderr, L"%s%s%s\n", s, colon, _(desc)); else -#endif (void) fprintf (stderr, "%s%s%s\n", s, colon, _(desc)); } else @@ -62,11 +59,9 @@ psignal (int sig, const char *s) (void) __asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig); -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) (void) __fwprintf (stderr, L"%s", buf); else -#endif (void) fputs (buf, stderr); free (buf); diff --git a/stdio-common/putw.c b/stdio-common/putw.c index ddf9ced..66a36fa 100644 --- a/stdio-common/putw.c +++ b/stdio-common/putw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 1998, 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,11 +17,8 @@ 02111-1307 USA. */ #include <stdio.h> - -#ifdef USE_IN_LIBIO -# include <libio/iolibio.h> -# define fwrite(p, n, m, s) INTUSE(_IO_fwrite) (p, n, m, s) -#endif +#include <libio/iolibio.h> +#define fwrite(p, n, m, s) INTUSE(_IO_fwrite) (p, n, m, s) /* Write the word (int) W to STREAM. */ int diff --git a/stdio-common/scanf.c b/stdio-common/scanf.c index 268aa90..62c9959 100644 --- a/stdio-common/scanf.c +++ b/stdio-common/scanf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,9 +20,7 @@ #include <stdarg.h> #include <stdio.h> -#ifdef USE_IN_LIBIO -# include <libioP.h> -#endif +#include <libioP.h> /* Read formatted input from stdin according to the format string FORMAT. */ @@ -33,11 +32,7 @@ scanf (const char *format, ...) int done; va_start (arg, format); -#ifdef USE_IN_LIBIO done = INTUSE(_IO_vfscanf) (stdin, format, arg, NULL); -#else - done = vfscanf (stdin, format, arg); -#endif va_end (arg); return done; diff --git a/stdio-common/snprintf.c b/stdio-common/snprintf.c index a880c4a..ce392f0 100644 --- a/stdio-common/snprintf.c +++ b/stdio-common/snprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1997, 1998, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,10 +19,8 @@ #include <stdarg.h> #include <stdio.h> -#ifdef USE_IN_LIBIO -# include <libio/libioP.h> -# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) -#endif +#include <libio/libioP.h> +#define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) /* Write formatted output into S, according to the format string FORMAT, writing no more than MAXLEN characters. */ diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c index 07e2654..249fcb0 100644 --- a/stdio-common/sprintf.c +++ b/stdio-common/sprintf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,11 +19,8 @@ #include <stdarg.h> #include <stdio.h> - -#ifdef USE_IN_LIBIO -# include <libio/iolibio.h> -# define vsprintf(s, f, a) INTUSE(_IO_vsprintf) (s, f, a) -#endif +#include <libio/iolibio.h> +#define vsprintf(s, f, a) INTUSE(_IO_vsprintf) (s, f, a) /* Write formatted output into S, according to the format string FORMAT. */ /* VARARGS2 */ @@ -40,6 +38,4 @@ sprintf (char *s, const char *format, ...) } libc_hidden_def (sprintf) -#ifdef USE_IN_LIBIO strong_alias(sprintf, _IO_sprintf) -#endif diff --git a/stdio-common/sscanf.c b/stdio-common/sscanf.c index ed4cb1d..b369767 100644 --- a/stdio-common/sscanf.c +++ b/stdio-common/sscanf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,1995,1996,1998,2002,2003 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,11 +19,8 @@ #include <stdarg.h> #include <stdio.h> - -#ifdef USE_IN_LIBIO -# include <libio/iolibio.h> -# define __vsscanf(s, f, a) _IO_vsscanf (s, f, a) -#endif +#include <libio/iolibio.h> +#define __vsscanf(s, f, a) _IO_vsscanf (s, f, a) /* Read formatted input from S, according to the format string FORMAT. */ /* VARARGS2 */ @@ -40,8 +38,6 @@ sscanf (const char *s, const char *format, ...) } libc_hidden_def (sscanf) -#ifdef USE_IN_LIBIO -# undef _IO_sscanf +#undef _IO_sscanf /* This is for libg++. */ strong_alias (sscanf, _IO_sscanf) -#endif diff --git a/stdio-common/tstgetln.c b/stdio-common/tstgetln.c index d328d57..e3080fa 100644 --- a/stdio-common/tstgetln.c +++ b/stdio-common/tstgetln.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,11 +18,8 @@ 02111-1307 USA. */ #include <stdio.h> - -#ifdef USE_IN_LIBIO -# undef ssize_t -# define ssize_t _IO_ssize_t -#endif +#undef ssize_t +#define ssize_t _IO_ssize_t int main (int argc, char *argv[]) diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 8465680..ee0326e 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,15 +39,13 @@ implementation as defined in ISO/IEC 9899:1990/Amendment 1:1995. */ -#ifdef USE_IN_LIBIO -/* This code is for use in libio. */ -# include <libioP.h> -# define FILE _IO_FILE -# undef va_list -# define va_list _IO_va_list -# undef BUFSIZ -# define BUFSIZ _IO_BUFSIZ -# define ARGCHECK(S, Format) \ +#include <libioP.h> +#define FILE _IO_FILE +#undef va_list +#define va_list _IO_va_list +#undef BUFSIZ +#define BUFSIZ _IO_BUFSIZ +#define ARGCHECK(S, Format) \ do \ { \ /* Check file argument for consistence. */ \ @@ -63,95 +61,46 @@ return -1; \ } \ } while (0) -# define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED) - -# ifndef COMPILE_WPRINTF -# define vfprintf _IO_vfprintf -# define CHAR_T char -# define UCHAR_T unsigned char -# define INT_T int -# define L_(Str) Str -# define ISDIGIT(Ch) ((unsigned int) ((Ch) - '0') < 10) - -# define PUT(F, S, N) _IO_sputn ((F), (S), (N)) -# define PAD(Padchar) \ +#define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED) + +#ifndef COMPILE_WPRINTF +# define vfprintf _IO_vfprintf +# define CHAR_T char +# define UCHAR_T unsigned char +# define INT_T int +# define L_(Str) Str +# define ISDIGIT(Ch) ((unsigned int) ((Ch) - '0') < 10) + +# define PUT(F, S, N) _IO_sputn ((F), (S), (N)) +# define PAD(Padchar) \ if (width > 0) \ done += INTUSE(_IO_padn) (s, (Padchar), width) -# define PUTC(C, F) _IO_putc_unlocked (C, F) -# define ORIENT if (_IO_vtable_offset (s) == 0 && _IO_fwide (s, -1) != -1)\ +# define PUTC(C, F) _IO_putc_unlocked (C, F) +# define ORIENT if (_IO_vtable_offset (s) == 0 && _IO_fwide (s, -1) != -1)\ return -1 -# else -# define vfprintf _IO_vfwprintf -# define CHAR_T wchar_t +#else +# define vfprintf _IO_vfwprintf +# define CHAR_T wchar_t /* This is a hack!!! There should be a type uwchar_t. */ -# define UCHAR_T unsigned int /* uwchar_t */ -# define INT_T wint_t -# define L_(Str) L##Str -# define ISDIGIT(Ch) ((unsigned int) ((Ch) - L'0') < 10) +# define UCHAR_T unsigned int /* uwchar_t */ +# define INT_T wint_t +# define L_(Str) L##Str +# define ISDIGIT(Ch) ((unsigned int) ((Ch) - L'0') < 10) -# include "_itowa.h" +# include "_itowa.h" -# 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) -# define PUTC(C, F) _IO_putwc_unlocked (C, F) -# define ORIENT if (_IO_fwide (s, 1) != 1) return -1 - -# define _itoa(Val, Buf, Base, Case) _itowa (Val, Buf, Base, Case) -# define _itoa_word(Val, Buf, Base, Case) _itowa_word (Val, Buf, Base, Case) -# undef EOF -# define EOF WEOF -# endif -#else /* ! USE_IN_LIBIO */ -/* This code is for use in the GNU C library. */ -# define ARGCHECK(S, Format) \ - do \ - { \ - /* Check file argument for consistence. */ \ - if (!__validfp (S) || !S->__mode.__write) \ - { \ - __set_errno (EBADF); \ - return -1; \ - } \ - if (Format == NULL) \ - { \ - __set_errno (EINVAL); \ - return -1; \ - } \ - if (!S->__seen) \ - { \ - if (__flshfp (S, EOF) == EOF) \ - return -1; \ - } \ - } \ - while (0) -# define UNBUFFERED_P(s) ((s)->__buffer == NULL) +# define PUTC(C, F) _IO_putwc_unlocked (C, F) +# define ORIENT if (_IO_fwide (s, 1) != 1) return -1 -# define CHAR_T char -# define UCHAR_T unsigned char -# define INT_T int -# define L_(Str) Str -# define ISDIGIT(Ch) isdigit (Ch) - -# define PUT(F, S, N) fwrite (S, 1, N, F) -ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); -# define PAD(Padchar) \ - if (width > 0) \ - { ssize_t __res = __printf_pad (s, (Padchar), width); \ - if (__res == -1) \ - { \ - done = -1; \ - goto all_done; \ - } \ - done += __res; } -# define PUTC(C, F) putc (C, F) - -/* XXX These declarations should go as soon as the stdio header files - have these prototypes. */ -extern void __flockfile (FILE *); -extern void __funlockfile (FILE *); -#endif /* USE_IN_LIBIO */ +# define _itoa(Val, Buf, Base, Case) _itowa (Val, Buf, Base, Case) +# define _itoa_word(Val, Buf, Base, Case) _itowa_word (Val, Buf, Base, Case) +# undef EOF +# define EOF WEOF +#endif #include "_i18n_number.h" @@ -1266,10 +1215,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) #ifdef ORIENT /* Check for correct orientation. */ - if ( -# ifdef USE_IN_LIBIO - _IO_vtable_offset (s) == 0 && -# endif + if (_IO_vtable_offset (s) == 0 && _IO_fwide (s, sizeof (CHAR_T) == 1 ? -1 : 1) != (sizeof (CHAR_T) == 1 ? -1 : 1)) /* The stream is already oriented otherwise. */ @@ -1305,13 +1251,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) #endif /* Lock stream. */ -#ifdef USE_IN_LIBIO _IO_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, s); _IO_flockfile (s); -#else - __libc_cleanup_region_start (1, (void (*) (void *)) &__funlockfile, s); - __flockfile (s); -#endif /* Write the literal text before the first format. */ outstring ((const UCHAR_T *) format, @@ -1906,13 +1847,8 @@ all_done: if (__builtin_expect (workstart != NULL, 0)) free (workstart); /* Unlock the stream. */ -#ifdef USE_IN_LIBIO _IO_funlockfile (s); _IO_cleanup_region_end (0); -#else - __funlockfile (s); - __libc_cleanup_region_end (0); -#endif return done; } @@ -2041,7 +1977,6 @@ group_number (CHAR_T *w, CHAR_T *rear_ptr, const char *grouping, return w; } -#ifdef USE_IN_LIBIO /* Helper "class" for `fprintf to unbuffered': creates a temporary buffer. */ struct helper_file { @@ -2159,7 +2094,7 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format, _IO_JUMPS (&helper._f) = (struct _IO_jump_t *) &_IO_helper_jumps; /* Now print to helper instead. */ -#if defined USE_IN_LIBIO && !defined COMPILE_WPRINTF +#ifndef COMPILE_WPRINTF result = INTUSE(_IO_vfprintf) (hp, format, args); #else result = vfprintf (hp, format, args); @@ -2193,91 +2128,25 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format, return result; } -#else /* !USE_IN_LIBIO */ - -static int -internal_function -buffered_vfprintf (register FILE *s, const CHAR_T *format, va_list args) -{ - char buf[BUFSIZ]; - int result; - - /* Orient the stream. */ -#ifdef ORIENT - ORIENT; -#endif - - s->__bufp = s->__buffer = buf; - s->__bufsize = sizeof buf; - s->__put_limit = s->__buffer + s->__bufsize; - s->__get_limit = s->__buffer; - - /* Now use buffer to print. */ - result = vfprintf (s, format, args); - - if (fflush (s) == EOF) - result = -1; - s->__buffer = s->__bufp = s->__get_limit = s->__put_limit = NULL; - s->__bufsize = 0; - - return result; -} - -/* Pads string with given number of a specified character. - This code is taken from iopadn.c of the GNU I/O library. */ -#define PADSIZE 16 -static const CHAR_T blanks[PADSIZE] = -{ L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), - L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' ') }; -static const CHAR_T zeroes[PADSIZE] = -{ L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), - L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0') }; - -ssize_t -#ifndef COMPILE_WPRINTF -__printf_pad (FILE *s, char pad, size_t count) -#else -__wprintf_pad (FILE *s, wchar_t pad, size_t count) -#endif -{ - const CHAR_T *padptr; - register size_t i; - - padptr = pad == L_(' ') ? blanks : zeroes; - - for (i = count; i >= PADSIZE; i -= PADSIZE) - if (PUT (s, padptr, PADSIZE) != PADSIZE) - return -1; - if (i > 0) - if (PUT (s, padptr, i) != i) - return -1; - - return count; -} -#undef PADSIZE -#endif /* USE_IN_LIBIO */ - -#ifdef USE_IN_LIBIO -# undef vfprintf -# ifdef strong_alias +#undef vfprintf +#ifdef strong_alias /* This is for glibc. */ -# ifdef COMPILE_WPRINTF +# ifdef COMPILE_WPRINTF strong_alias (_IO_vfwprintf, __vfwprintf); weak_alias (_IO_vfwprintf, vfwprintf); -# else +# else strong_alias (_IO_vfprintf, vfprintf); libc_hidden_def (vfprintf) INTDEF(_IO_vfprintf) -# endif -# else -# if defined __ELF__ || defined __GNU_LIBRARY__ -# include <gnu-stabs.h> -# ifdef weak_alias -# ifdef COMPILE_WPRINTF +# endif +#else +# if defined __ELF__ || defined __GNU_LIBRARY__ +# include <gnu-stabs.h> +# ifdef weak_alias +# ifdef COMPILE_WPRINTF weak_alias (_IO_vfwprintf, vfwprintf); -# else +# else weak_alias (_IO_vfprintf, vfprintf); -# endif # endif # endif # endif |