libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

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

mhd_sockets: renamed macros for clarity

Diffstat:
Msrc/microhttpd/daemon.c | 5+++--
Msrc/microhttpd/mhd_send.c | 6+++---
Msrc/microhttpd/mhd_sockets.c | 6+++---
Msrc/microhttpd/mhd_sockets.h | 18+++++++++---------
4 files changed, 18 insertions(+), 17 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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)) /**