dup2: minor simplifications
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Sep 2011 05:49:14 +0000 (22:49 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 25 Sep 2011 05:49:14 +0000 (22:49 -0700)
* lib/dup2.c (ms_windows_dup2): Omit 'inline' as it's not clear
that it's a performance win.
(rpl_dup2): Change "if !((defined _WIN32 || defined __WIN32__) &&
! defined __CYGWIN__)" to "ifdef F_GETFL".

ChangeLog
lib/dup2.c

index f154617..c297087 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       dup2: minor simplifications
+       * lib/dup2.c (ms_windows_dup2): Omit 'inline' as it's not clear
+       that it's a performance win.
+       (rpl_dup2): Change "if !((defined _WIN32 || defined __WIN32__) &&
+       ! defined __CYGWIN__)" to "ifdef F_GETFL".
+
 2011-09-24  Jim Meyering  <meyering@redhat.com>
 
        test-futimens: avoid a warning from gcc -Wshadow
index 278261f..790c98a 100644 (file)
@@ -40,7 +40,7 @@
 /* Get _get_osfhandle.  */
 #  include "msvc-nothrow.h"
 
-static inline int
+static int
 ms_windows_dup2 (int fd, int desired_fd)
 {
   int result;
@@ -92,7 +92,7 @@ rpl_dup2 (int fd, int desired_fd)
 {
   int result;
 
-# if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# ifdef F_GETFL
   /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
      On Cygwin 1.5.x, dup2 (1, 1) returns 0.
      On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC.  */