From c794f07135a841322588b962c298469ac367468d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 24 Aug 2009 00:34:04 +0200 Subject: [PATCH] Move #ifs inside function. --- ChangeLog | 4 ++++ lib/pipe2.c | 26 +++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fc1016b5f..438cc9c553 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-08-23 Bruno Haible + + * lib/pipe2.c (pipe2): Move #ifs inside function. + 2009-08-22 Joel E. Denny quotearg: document limitations of quote_these_too diff --git a/lib/pipe2.c b/lib/pipe2.c index 726813f9af..d5833ddfcc 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -28,9 +28,21 @@ # include +#else +/* Unix API. */ + +# ifndef O_CLOEXEC +# define O_CLOEXEC 0 +# endif + +#endif + int pipe2 (int fd[2], int flags) { +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Native Woe32 API. */ + /* Check the supported flags. */ if ((flags & ~(O_CLOEXEC | O_BINARY | O_TEXT)) != 0) { @@ -39,18 +51,10 @@ pipe2 (int fd[2], int flags) } return _pipe (fd, 4096, flags); -} #else /* Unix API. */ -# ifndef O_CLOEXEC -# define O_CLOEXEC 0 -# endif - -int -pipe2 (int fd[2], int flags) -{ /* Check the supported flags. */ if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_TEXT | O_BINARY)) != 0) { @@ -87,7 +91,7 @@ pipe2 (int fd[2], int flags) goto fail; } -#if O_BINARY +# if O_BINARY if (flags & O_BINARY) { setmode (fd[1], O_BINARY); @@ -98,7 +102,7 @@ pipe2 (int fd[2], int flags) setmode (fd[1], O_TEXT); setmode (fd[0], O_TEXT); } -#endif +# endif return 0; @@ -110,6 +114,6 @@ pipe2 (int fd[2], int flags) errno = saved_errno; return -1; } -} #endif +} -- 2.30.2