summary refs log tree commit diff
path: root/libio/iofwide.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-08-25 21:45:12 +0000
committerUlrich Drepper <drepper@redhat.com>2003-08-25 21:45:12 +0000
commit1c8c5277a7045ddd3d9b2db50be7e80318b7975c (patch)
tree57e72aa4927ca26b94713e1f144d3ba84bef3308 /libio/iofwide.c
parent0b9225cd7ffd2a6289e780f2c4bbca04f6868ac3 (diff)
downloadglibc-1c8c5277a7045ddd3d9b2db50be7e80318b7975c.tar.gz
glibc-1c8c5277a7045ddd3d9b2db50be7e80318b7975c.tar.xz
glibc-1c8c5277a7045ddd3d9b2db50be7e80318b7975c.zip
Update.
2003-08-25  Ulrich Drepper  <drepper@redhat.com>

	* libio/libio.h (_IO_fwide): In the mode==0 optimization, don't
	use _mode if _IO_fwide_maybe_incompatible.
	* libio/iofwide.c (_IO_fwide): Move the test for mode == 0 after
	the compatibility test.
Diffstat (limited to 'libio/iofwide.c')
-rw-r--r--libio/iofwide.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libio/iofwide.c b/libio/iofwide.c
index 225237ef66..03124219ad 100644
--- a/libio/iofwide.c
+++ b/libio/iofwide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 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
@@ -100,20 +100,18 @@ _IO_fwide (fp, mode)
   /* Normalize the value.  */
   mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
 
-  if (mode == 0)
-    /* The caller simply wants to know about the current orientation.  */
-    return fp->_mode;
-
 #if defined SHARED && defined _LIBC \
     && 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))
+      && (fp == _IO_stdin || fp == _IO_stdout || fp == _IO_stderr))
     /* This is for a stream in the glibc 2.0 format.  */
     return -1;
 #endif
 
-  if (fp->_mode != 0)
-    /* The orientation already has been determined.  */
+  /* The orientation already has been determined.  */
+  if (fp->_mode != 0
+      /* Or the caller simply wants to know about the current orientation.  */
+      || mode == 0)
     return fp->_mode;
 
   /* Set the orientation appropriately.  */