diff options
author | Florian Weimer <fweimer@redhat.com> | 2019-02-18 11:49:54 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2019-02-18 16:37:00 +0100 |
commit | a5406364ac949f91867352cb2ae867629f083c5b (patch) | |
tree | 0aeeedc3748d3b21cf8e8ea2e670670df1e441db /libio/oldstdfiles.c | |
parent | 6c29942cbf059aca47fd4bbd852ea42c9d46b71f (diff) | |
download | glibc-a5406364ac949f91867352cb2ae867629f083c5b.zip glibc-a5406364ac949f91867352cb2ae867629f083c5b.tar.gz glibc-a5406364ac949f91867352cb2ae867629f083c5b.tar.bz2 |
libio: Eliminate _IO_stdin, _IO_stdout, _IO_stderr
These variables are only used to determine if a stdio stream is
a pre-allocated stream, but it is possible to do so by comparing
a FILE * to all pre-allocated stream objects. As a result, it is
not necessary to keep those pointers in separate variables.
Behavior with symbol interposition is unchanged because _IO_stdin_,
_IO_stdout_, _IO_stderr_ are exported, and refer to objects outside of
libc if symbol interposition or copy relocations are involved. (The
removed variables _IO_stdin, _IO_stdout, _IO_stderr were not exported,
of course.)
Diffstat (limited to 'libio/oldstdfiles.c')
-rw-r--r-- | libio/oldstdfiles.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c index 524e260..2b861cd 100644 --- a/libio/oldstdfiles.c +++ b/libio/oldstdfiles.c @@ -27,11 +27,8 @@ #include <shlib-compat.h> #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr - for C code. Compare stdstreams.cc. - (The difference is that here the vtable field is set to 0, - so the objects defined are not valid C++ objects. On the other - hand, we don't need a C++ compiler to build this file.) */ +/* This file provides legacy definitions of _IO_stdin_, _IO_stdout_, + and _IO_stderr_. See stdfiles.c for the current definitions. */ #define _IO_USE_OLD_IO_FILE #include "libioP.h" @@ -78,13 +75,12 @@ _IO_check_libio (void) if (&_IO_stdin_used == NULL) { /* We are using the old one. */ - _IO_stdin = stdin = (FILE *) &_IO_stdin_; - _IO_stdout = stdout = (FILE *) &_IO_stdout_; - _IO_stderr = stderr = (FILE *) &_IO_stderr_; + stdin = (FILE *) &_IO_stdin_; + stdout = (FILE *) &_IO_stdout_; + stderr = (FILE *) &_IO_stderr_; _IO_list_all = &_IO_stderr_; - _IO_stdin->_vtable_offset = _IO_stdout->_vtable_offset = - _IO_stderr->_vtable_offset = stdin->_vtable_offset = - stdout->_vtable_offset = stderr->_vtable_offset = + stdin->_vtable_offset = stdout->_vtable_offset + = stderr->_vtable_offset = ((int) sizeof (struct _IO_FILE) - (int) sizeof (struct _IO_FILE_complete)); } |