gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 03/05: mhd_sockets: renamed macros for clarity


From: gnunet
Subject: [libmicrohttpd] 03/05: mhd_sockets: renamed macros for clarity
Date: Sun, 29 Nov 2020 19:50:12 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit c900f818ca43368c6e6f27161af7158e51e8fb59
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Nov 29 20:57:56 2020 +0300

    mhd_sockets: renamed macros for clarity
---
 src/microhttpd/daemon.c      |  5 +++--
 src/microhttpd/mhd_send.c    |  6 +++---
 src/microhttpd/mhd_sockets.c |  6 +++---
 src/microhttpd/mhd_sockets.h | 18 +++++++++---------
 4 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f75d02b1..d16d205a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3444,8 +3444,9 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
   s = accept4 (fd,
                addr,
                &addrlen,
-               MAYBE_SOCK_CLOEXEC | MAYBE_SOCK_NONBLOCK | 
MAYBE_SOCK_NOSIGPIPE);
-  sk_nonbl = (MAYBE_SOCK_NONBLOCK != 0);
+               SOCK_CLOEXEC_OR_ZERO | SOCK_NONBLOCK_OR_ZERO
+               | SOCK_NOSIGPIPE_OR_ZERO);
+  sk_nonbl = (SOCK_NONBLOCK_OR_ZERO != 0);
 #else  /* ! USE_ACCEPT4 */
   s = accept (fd,
               addr,
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 3b9bc4d9..fce83cd5 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -400,13 +400,13 @@ MHD_send_on_connection_ (struct MHD_Connection 
*connection,
     ret = send (s,
                 buffer,
                 buffer_size,
-                MAYBE_MSG_NOSIGNAL | (want_cork ? MSG_MORE : 0));
+                MSG_NOSIGNAL_OR_ZERO | (want_cork ? MSG_MORE : 0));
     connection->sk_cork_on = want_cork; /* pretend corking happened as 
requested */
 #else
     ret = send (connection->socket_fd,
                 buffer,
                 buffer_size,
-                MAYBE_MSG_NOSIGNAL);
+                MSG_NOSIGNAL_OR_ZERO);
 #endif
 
     if (0 > ret)
@@ -511,7 +511,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
     msg.msg_iov = vector;
     msg.msg_iovlen = 2;
 
-    ret = sendmsg (s, &msg, MAYBE_MSG_NOSIGNAL);
+    ret = sendmsg (s, &msg, MSG_NOSIGNAL_OR_ZERO);
     if ( (-1 == ret) &&
          (EAGAIN == errno) )
       return MHD_ERR_AGAIN_;
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index 89bcb0ac..d5da49bd 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -585,11 +585,11 @@ MHD_socket_create_listen_ (int pf)
 #if defined(MHD_POSIX_SOCKETS) && (defined(SOCK_CLOEXEC) || \
   defined(SOCK_NOSIGPIPE) )
   fd = socket (pf,
-               SOCK_STREAM | SOCK_CLOEXEC | MAYBE_SOCK_NOSIGPIPE,
+               SOCK_STREAM | SOCK_CLOEXEC | SOCK_NOSIGPIPE_OR_ZERO,
                0);
-  cloexec_set = (MAYBE_SOCK_CLOEXEC != 0);
+  cloexec_set = (SOCK_CLOEXEC_OR_ZERO != 0);
 #if defined(SOCK_NOSIGPIPE) || defined(MHD_socket_nosignal_)
-  nosigpipe_set = (MAYBE_SOCK_NOSIGPIPE != 0);
+  nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
 #endif /* SOCK_NOSIGPIPE ||  MHD_socket_nosignal_ */
 #elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT)
   fd = WSASocketW (pf,
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
index 0241ef28..4dfc1ca3 100644
--- a/src/microhttpd/mhd_sockets.h
+++ b/src/microhttpd/mhd_sockets.h
@@ -157,27 +157,27 @@ typedef SOCKET MHD_socket;
 #endif /* ! MHD_SOCKET_DEFINED */
 
 #ifdef SOCK_CLOEXEC
-#  define MAYBE_SOCK_CLOEXEC SOCK_CLOEXEC
+#  define SOCK_CLOEXEC_OR_ZERO SOCK_CLOEXEC
 #else  /* ! SOCK_CLOEXEC */
-#  define MAYBE_SOCK_CLOEXEC 0
+#  define SOCK_CLOEXEC_OR_ZERO 0
 #endif /* ! SOCK_CLOEXEC */
 
 #ifdef HAVE_SOCK_NONBLOCK
-#  define MAYBE_SOCK_NONBLOCK SOCK_NONBLOCK
+#  define SOCK_NONBLOCK_OR_ZERO SOCK_NONBLOCK
 #else  /* ! HAVE_SOCK_NONBLOCK */
-#  define MAYBE_SOCK_NONBLOCK 0
+#  define SOCK_NONBLOCK_OR_ZERO 0
 #endif /* ! HAVE_SOCK_NONBLOCK */
 
 #ifdef SOCK_NOSIGPIPE
-#  define MAYBE_SOCK_NOSIGPIPE SOCK_NOSIGPIPE
+#  define SOCK_NOSIGPIPE_OR_ZERO SOCK_NOSIGPIPE
 #else  /* ! HAVE_SOCK_NONBLOCK */
-#  define MAYBE_SOCK_NOSIGPIPE 0
+#  define SOCK_NOSIGPIPE_OR_ZERO 0
 #endif /* ! HAVE_SOCK_NONBLOCK */
 
 #ifdef MSG_NOSIGNAL
-#  define MAYBE_MSG_NOSIGNAL MSG_NOSIGNAL
+#  define MSG_NOSIGNAL_OR_ZERO MSG_NOSIGNAL
 #else  /* ! MSG_NOSIGNAL */
-#  define MAYBE_MSG_NOSIGNAL 0
+#  define MSG_NOSIGNAL_OR_ZERO 0
 #endif /* ! MSG_NOSIGNAL */
 
 #if ! defined(SHUT_WR) && defined(SD_SEND)
@@ -284,7 +284,7 @@ typedef int MHD_SCKT_SEND_SIZE_;
  */
 #define MHD_send_(s,b,l) \
   ((ssize_t) send ((s),(const void*) (b),(MHD_SCKT_SEND_SIZE_) (l), \
-                   MAYBE_MSG_NOSIGNAL))
+                   MSG_NOSIGNAL_OR_ZERO))
 
 
 /**

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]