]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
libio: Clean up _IO_file_doallocate and _IO_wfile_doallocate
authorFlorian Weimer <fweimer@redhat.com>
Mon, 7 Mar 2016 16:05:06 +0000 (17:05 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 7 Mar 2016 16:05:06 +0000 (17:05 +0100)
No functional changes.

ChangeLog
libio/filedoalloc.c
libio/wfiledoalloc.c

index c57c2fe576dce088c562db9408d290a0e8fc365b..882f22ce9c360fdad2541a297413c8c8398e2db7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-03-07  Florian Weimer  <fweimer@redhat.com>
+
+       * libio/filedoalloc.c (isatty): Remove.
+       (local_isatty): Add comment.  Call __isatty directly.
+       (_IO_file_doallocate): Update comment.  Assume _LIBC.
+       * libio/wfiledoalloc.c (isatty): Remove.
+       (_IO_wfile_doallocate): Update comment.
+
 2016-03-07  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #19269]
index b51e9101312a0aaf59f4e96646f497dd2faffa56..4f9d73896820b9d8245e7970814f493ad7a1b633 100644 (file)
 
 /* Modified for GNU iostream by Per Bothner 1991, 1992. */
 
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
 #include "libioP.h"
-#include <sys/types.h>
+#include <device-nrs.h>
 #include <sys/stat.h>
 #include <stdlib.h>
 #include <unistd.h>
 
-#ifdef _LIBC
-# undef isatty
-# define isatty(Fd) __isatty (Fd)
-
-# include <device-nrs.h>
-#endif
-
-
+/* Return the result of isatty, without changing errno.  */
 static int
 local_isatty (int fd)
 {
   int save_errno = errno;
-  int res = isatty (fd);
+  int res = __isatty (fd);
   __set_errno (save_errno);
   return res;
 }
 
-
-/*
- * Allocate a file buffer, or switch to unbuffered I/O.
- * Per the ANSI C standard, ALL tty devices default to line buffered.
- *
- * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
- * optimisation) right after the _fstat() that finds the buffer size.
- */
-
+/* Allocate a file buffer, or switch to unbuffered I/O.  Streams for
+   TTY devices default to line buffered.  */
 int
 _IO_file_doallocate (_IO_FILE *fp)
 {
@@ -97,15 +80,6 @@ _IO_file_doallocate (_IO_FILE *fp)
   char *p;
   struct stat64 st;
 
-#ifndef _LIBC
-  /* If _IO_cleanup_registration_needed is non-zero, we should call the
-     function it points to.  This is to make sure _IO_cleanup gets called
-     on exit.  We call it from _IO_file_doallocate, since that is likely
-     to get called by any program that does buffered I/O. */
-  if (__glibc_unlikely (_IO_cleanup_registration_needed != NULL))
-    (*_IO_cleanup_registration_needed) ();
-#endif
-
   size = _IO_BUFSIZ;
   if (fp->_fileno >= 0 && __builtin_expect (_IO_SYSSTAT (fp, &st), 0) >= 0)
     {
index 28c10b6d0d6bebdc076672ff1152bbd5d4c12879..333b03635b4baab5c89e96abc0565529ba5b2431 100644 (file)
 
 /* Modified for GNU iostream by Per Bothner 1991, 1992. */
 
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
 #include "libioP.h"
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <stdlib.h>
-#include <unistd.h>
-
-#ifdef _LIBC
-# undef isatty
-# define isatty(Fd) __isatty (Fd)
-#endif
-
-/*
- * Allocate a file buffer, or switch to unbuffered I/O.
- * Per the ANSI C standard, ALL tty devices default to line buffered.
- *
- * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
- * optimisation) right after the _fstat() that finds the buffer size.
- */
 
+/* Allocate a file buffer, or switch to unbuffered I/O.  */
 int
 _IO_wfile_doallocate (_IO_FILE *fp)
 {