commit 08039fcf03c18b54628253b2a933e6fd1e089dbb
parent 23b704ee3dcbc6d05eb5230e590207d08ab7c49a
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Fri, 4 Dec 2020 11:55:38 +0300
mhd_send.c: use wrapper macro for send()
Diffstat:
2 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
@@ -387,15 +387,15 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
buffer_size = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */
#ifdef MHD_USE_MSG_MORE
- ret = send (s,
- buffer,
- buffer_size,
- MSG_NOSIGNAL_OR_ZERO | (push_data ? 0 : MSG_MORE));
+ ret = MHD_send4_ (s,
+ buffer,
+ buffer_size,
+ push_data ? 0 : MSG_MORE);
#else
- ret = send (connection->socket_fd,
- buffer,
- buffer_size,
- MSG_NOSIGNAL_OR_ZERO);
+ ret = MHD_send4_ (s,
+ buffer,
+ buffer_size,
+ 0);
#endif
if (0 > ret)
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
@@ -284,15 +284,26 @@ typedef int MHD_SCKT_SEND_SIZE_;
/**
- * MHD_send_ is wrapper for system's send()
+ * MHD_send4_ is a wrapper for system's send()
* @param s the socket to use
* @param b the buffer with data to send
* @param l the length of data in @a b
+ * @param f the additional flags
* @return ssize_t type value
*/
-#define MHD_send_(s,b,l) \
+#define MHD_send4_(s,b,l,f) \
((ssize_t) send ((s),(const void*) (b),(MHD_SCKT_SEND_SIZE_) (l), \
- MSG_NOSIGNAL_OR_ZERO))
+ ((MSG_NOSIGNAL_OR_ZERO) | (f))))
+
+
+/**
+ * MHD_send_ is a simple wrapper for system's send()
+ * @param s the socket to use
+ * @param b the buffer with data to send
+ * @param l the length of data in @a b
+ * @return ssize_t type value
+ */
+#define MHD_send_(s,b,l) MHD_send4_((s),(b),(l), 0)
/**