From a5406364ac949f91867352cb2ae867629f083c5b Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 18 Feb 2019 11:49:54 +0100 Subject: 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.) --- libio/iofwide.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libio/iofwide.c') diff --git a/libio/iofwide.c b/libio/iofwide.c index 6676ad5e53..247cfde3d0 100644 --- a/libio/iofwide.c +++ b/libio/iofwide.c @@ -87,8 +87,7 @@ _IO_fwide (FILE *fp, int mode) mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1); #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) - if (__builtin_expect (&_IO_stdin_used == NULL, 0) - && (fp == _IO_stdin || fp == _IO_stdout || fp == _IO_stderr)) + if (__glibc_unlikely (&_IO_stdin_used == NULL) && _IO_legacy_file (fp)) /* This is for a stream in the glibc 2.0 format. */ return -1; #endif -- cgit 1.4.1