commit a22b8cdf03889885c9a0d30fef9d5233a97ede35
parent d50159bf9987c018e9ca7ed4cd72390494678da1
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Tue, 23 Feb 2021 17:35:49 +0300
mhd_send: re-use MHD_VECT_SEND macro
Diffstat:
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
@@ -782,10 +782,6 @@ MHD_send_data_ (struct MHD_Connection *connection,
}
-#if defined(HAVE_SENDMSG) || defined(HAVE_WRITEV) || defined(_WIN32)
-#define _MHD_USE_SEND_VEC 1
-#endif /* HAVE_SENDMSG || HAVE_WRITEV || _WIN32*/
-
ssize_t
MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
const char *header,
@@ -804,7 +800,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
#else /* ! _WIN32 */
#define _MHD_SEND_VEC_MAX UINT32_MAX
#endif /* ! _WIN32 */
-#ifdef _MHD_USE_SEND_VEC
+#ifdef MHD_VECT_SEND
#if defined(HAVE_SENDMSG) || defined(HAVE_WRITEV)
struct iovec vector[2];
#ifdef HAVE_SENDMSG
@@ -829,7 +825,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
#endif /* (!HAVE_SENDMSG || ! MSG_NOSIGNAL) &&
MHD_SEND_SPIPE_SEND_SUPPRESS_POSSIBLE &&
MHD_SEND_SPIPE_SUPPRESS_NEEDED */
-#endif /* _MHD_USE_SEND_VEC */
+#endif /* MHD_VECT_SEND */
mhd_assert ( (NULL != body) || (0 == body_size) );
@@ -866,7 +862,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
push_hdr = true; /* The header alone is equal to the whole response. */
if (
-#ifdef _MHD_USE_SEND_VEC
+#ifdef MHD_VECT_SEND
(no_vec) ||
(0 == body_size) ||
((size_t) SSIZE_MAX <= header_size) ||
@@ -874,9 +870,9 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
#ifdef _WIN32
|| ((size_t) UINT_MAX < header_size)
#endif /* _WIN32 */
-#else /* ! _MHD_USE_SEND_VEC */
+#else /* ! MHD_VECT_SEND */
true
-#endif /* ! _MHD_USE_SEND_VEC */
+#endif /* ! MHD_VECT_SEND */
)
{
ret = MHD_send_data_ (connection,
@@ -915,7 +911,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
}
return ret;
}
-#ifdef _MHD_USE_SEND_VEC
+#ifdef MHD_VECT_SEND
if ( ((size_t) SSIZE_MAX <= body_size) ||
((size_t) SSIZE_MAX < (header_size + body_size)) )
@@ -1040,10 +1036,10 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
}
return ret;
-#else /* ! _MHD_USE_SEND_VEC */
+#else /* ! MHD_VECT_SEND */
mhd_assert (false);
return MHD_ERR_CONNRESET_; /* Unreachable. Mute warnings. */
-#endif /* ! _MHD_USE_SEND_VEC */
+#endif /* ! MHD_VECT_SEND */
}