From bbdef797baaddf4c85163832972fd0140cad964d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 12 Aug 2003 18:40:03 +0000 Subject: Update. 2003-08-12 Jakub Jelinek * libio/libioP.h (_IO_vtable_offset): Define. * libio/freopen.c (freopen): Use it. * libio/ioputs.c (_IO_puts): Likewise. * libio/freopen64.c (freopen64): Likewise. * libio/genops.c (__underflow, __uflow, _IO_flush_all_lockp): Likewise. * libio/iofclose.c (_IO_new_fclose): Likewise. * libio/iofputs.c (_IO_fputs): Likewise. * libio/ioftell.c (_IO_ftell): Likewise. * libio/iofwrite.c (_IO_fwrite): Likewise. * libio/ioseekoff.c (_IO_seekoff_unlocked): Likewise. * libio/iosetbuffer.c (_IO_setbuffer): Likewise. * stdio-common/vfprintf.c (ORIENT, vfprintf): Likewise. * stdio-common/vfscanf.c (ORIENT): Likewise. --- libio/freopen.c | 2 +- libio/freopen64.c | 2 +- libio/genops.c | 6 +++--- libio/iofclose.c | 4 ++-- libio/iofputs.c | 5 +++-- libio/ioftell.c | 4 ++-- libio/iofwrite.c | 5 +++-- libio/ioputs.c | 5 +++-- libio/ioseekoff.c | 5 +++-- libio/iosetbuffer.c | 5 +++-- libio/libioP.h | 2 ++ 11 files changed, 26 insertions(+), 19 deletions(-) (limited to 'libio') diff --git a/libio/freopen.c b/libio/freopen.c index 7301da7f48..cae9d307cd 100644 --- a/libio/freopen.c +++ b/libio/freopen.c @@ -69,7 +69,7 @@ freopen (filename, mode, fp) { INTUSE(_IO_file_close_it) (fp); _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps; - if (fp->_vtable_offset == 0 && fp->_wide_data != NULL) + if (_IO_vtable_offset (fp) == 0 && fp->_wide_data != NULL) fp->_wide_data->_wide_vtable = &_IO_wfile_jumps; result = INTUSE(_IO_file_fopen) (fp, filename, mode, 1); if (result != NULL) diff --git a/libio/freopen64.c b/libio/freopen64.c index 4176dd0511..d57994df05 100644 --- a/libio/freopen64.c +++ b/libio/freopen64.c @@ -54,7 +54,7 @@ freopen64 (filename, mode, fp) } INTUSE(_IO_file_close_it) (fp); _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps; - if (fp->_vtable_offset == 0 && fp->_wide_data != NULL) + if (_IO_vtable_offset (fp) == 0 && fp->_wide_data != NULL) fp->_wide_data->_wide_vtable = &_IO_wfile_jumps; result = INTUSE(_IO_file_fopen) (fp, filename, mode, 0); if (result != NULL) diff --git a/libio/genops.c b/libio/genops.c index 8077268ba9..88877ad3f0 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -324,7 +324,7 @@ __underflow (fp) _IO_FILE *fp; { #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T - if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1) + if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1) return EOF; #endif @@ -357,7 +357,7 @@ __uflow (fp) _IO_FILE *fp; { #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T - if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1) + if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1) return EOF; #endif @@ -834,7 +834,7 @@ _IO_flush_all_lockp (int do_lock) if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base) #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T - || (fp->_vtable_offset == 0 + || (_IO_vtable_offset (fp) == 0 && fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)) #endif diff --git a/libio/iofclose.c b/libio/iofclose.c index 62d12244c5..eb01c88755 100644 --- a/libio/iofclose.c +++ b/libio/iofclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,1995,1997-2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1993,1995,1997-2001,2002,2003 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 @@ -49,7 +49,7 @@ _IO_new_fclose (fp) /* We desperately try to help programs which are using streams in a strange way and mix old and new functions. Detect old streams here. */ - if (fp->_vtable_offset != 0) + if (_IO_vtable_offset (fp) != 0) return _IO_old_fclose (fp); #endif diff --git a/libio/iofputs.c b/libio/iofputs.c index 1201735a38..088fd5fd4f 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993,1996,1997,1998,1999,2002 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2003 + 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 @@ -38,7 +39,7 @@ _IO_fputs (str, fp) CHECK_FILE (fp, EOF); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); - if ((fp->_vtable_offset != 0 || _IO_fwide (fp, -1) == -1) + if ((_IO_vtable_offset (fp) != 0 || _IO_fwide (fp, -1) == -1) && _IO_sputn (fp, str, len) == len) result = 1; _IO_funlockfile (fp); diff --git a/libio/ioftell.c b/libio/ioftell.c index fd5da6b618..589a2a274d 100644 --- a/libio/ioftell.c +++ b/libio/ioftell.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995-2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1993,1995-2000,2001,2002,2003 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 @@ -41,7 +41,7 @@ _IO_ftell (fp) pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0); if (_IO_in_backup (fp)) { - if (fp->_vtable_offset != 0 || fp->_mode <= 0) + if (_IO_vtable_offset (fp) != 0 || fp->_mode <= 0) pos -= fp->_IO_save_end - fp->_IO_save_base; } _IO_funlockfile (fp); diff --git a/libio/iofwrite.c b/libio/iofwrite.c index 67ed6a1f12..6f0d273574 100644 --- a/libio/iofwrite.c +++ b/libio/iofwrite.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993,96,97,98,99,2000,2002 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2002, 2003 + 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 @@ -41,7 +42,7 @@ _IO_fwrite (buf, size, count, fp) return 0; _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); - if (fp->_vtable_offset != 0 || _IO_fwide (fp, -1) == -1) + if (_IO_vtable_offset (fp) != 0 || _IO_fwide (fp, -1) == -1) written = _IO_sputn (fp, (const char *) buf, request); _IO_funlockfile (fp); _IO_cleanup_region_end (0); diff --git a/libio/ioputs.c b/libio/ioputs.c index 8a9a595f90..f878ea6b55 100644 --- a/libio/ioputs.c +++ b/libio/ioputs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1993,1996,1997,1998,1999,2003 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 @@ -38,7 +38,8 @@ _IO_puts (str) _IO_stdout); _IO_flockfile (_IO_stdout); - if ((_IO_stdout->_vtable_offset != 0 || _IO_fwide (_IO_stdout, -1) == -1) + if ((_IO_vtable_offset (_IO_stdout) != 0 + || _IO_fwide (_IO_stdout, -1) == -1) && _IO_sputn (_IO_stdout, str, len) == len && _IO_putc_unlocked ('\n', _IO_stdout) != EOF) result = len + 1; diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c index 09c138869e..9229166705 100644 --- a/libio/ioseekoff.c +++ b/libio/ioseekoff.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993,1997,1998,1999,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003 + 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 @@ -56,7 +57,7 @@ _IO_seekoff_unlocked (fp, offset, dir, mode) { if (dir == _IO_seek_cur && _IO_in_backup (fp)) { - if (fp->_vtable_offset != 0 || fp->_mode <= 0) + if (_IO_vtable_offset (fp) != 0 || fp->_mode <= 0) offset -= fp->_IO_read_end - fp->_IO_read_ptr; else abort (); diff --git a/libio/iosetbuffer.c b/libio/iosetbuffer.c index 785fcab4bd..2497304076 100644 --- a/libio/iosetbuffer.c +++ b/libio/iosetbuffer.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993,95,96,97,98,99,2000,2002 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 + 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 @@ -40,7 +41,7 @@ _IO_setbuffer (fp, buf, size) if (!buf) size = 0; (void) _IO_SETBUF (fp, buf, size); - if (fp->_vtable_offset == 0 && fp->_mode == 0 && _IO_CHECK_WIDE (fp)) + if (_IO_vtable_offset (fp) == 0 && fp->_mode == 0 && _IO_CHECK_WIDE (fp)) /* We also have to set the buffer using the wide char function. */ (void) _IO_WSETBUF (fp, buf, size); _IO_funlockfile (fp); diff --git a/libio/libioP.h b/libio/libioP.h index 38daa1daff..1d30eef5cd 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -110,8 +110,10 @@ extern "C" { # define _IO_JUMPS_FUNC(THIS) \ (*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \ + (THIS)->_vtable_offset)) +# define _IO_vtable_offset(THIS) (THIS)->_vtable_offset #else # define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) +# define _IO_vtable_offset(THIS) 0 #endif #define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS) #ifdef _G_USING_THUNKS -- cgit 1.4.1