diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-02-23 17:35:49 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-02-24 19:46:31 +0300 |
commit | a22b8cdf03889885c9a0d30fef9d5233a97ede35 (patch) | |
tree | b7d643ba00212c5ffb4fbcc0898c5dab50d4e7e8 | |
parent | d50159bf9987c018e9ca7ed4cd72390494678da1 (diff) | |
download | libmicrohttpd-a22b8cdf03889885c9a0d30fef9d5233a97ede35.tar.gz libmicrohttpd-a22b8cdf03889885c9a0d30fef9d5233a97ede35.zip |
mhd_send: re-use MHD_VECT_SEND macro
-rw-r--r-- | src/microhttpd/mhd_send.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index fd67300c..c2cded87 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c | |||
@@ -782,10 +782,6 @@ MHD_send_data_ (struct MHD_Connection *connection, | |||
782 | } | 782 | } |
783 | 783 | ||
784 | 784 | ||
785 | #if defined(HAVE_SENDMSG) || defined(HAVE_WRITEV) || defined(_WIN32) | ||
786 | #define _MHD_USE_SEND_VEC 1 | ||
787 | #endif /* HAVE_SENDMSG || HAVE_WRITEV || _WIN32*/ | ||
788 | |||
789 | ssize_t | 785 | ssize_t |
790 | MHD_send_hdr_and_body_ (struct MHD_Connection *connection, | 786 | MHD_send_hdr_and_body_ (struct MHD_Connection *connection, |
791 | const char *header, | 787 | const char *header, |
@@ -804,7 +800,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection, | |||
804 | #else /* ! _WIN32 */ | 800 | #else /* ! _WIN32 */ |
805 | #define _MHD_SEND_VEC_MAX UINT32_MAX | 801 | #define _MHD_SEND_VEC_MAX UINT32_MAX |
806 | #endif /* ! _WIN32 */ | 802 | #endif /* ! _WIN32 */ |
807 | #ifdef _MHD_USE_SEND_VEC | 803 | #ifdef MHD_VECT_SEND |
808 | #if defined(HAVE_SENDMSG) || defined(HAVE_WRITEV) | 804 | #if defined(HAVE_SENDMSG) || defined(HAVE_WRITEV) |
809 | struct iovec vector[2]; | 805 | struct iovec vector[2]; |
810 | #ifdef HAVE_SENDMSG | 806 | #ifdef HAVE_SENDMSG |
@@ -829,7 +825,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection, | |||
829 | #endif /* (!HAVE_SENDMSG || ! MSG_NOSIGNAL) && | 825 | #endif /* (!HAVE_SENDMSG || ! MSG_NOSIGNAL) && |
830 | MHD_SEND_SPIPE_SEND_SUPPRESS_POSSIBLE && | 826 | MHD_SEND_SPIPE_SEND_SUPPRESS_POSSIBLE && |
831 | MHD_SEND_SPIPE_SUPPRESS_NEEDED */ | 827 | MHD_SEND_SPIPE_SUPPRESS_NEEDED */ |
832 | #endif /* _MHD_USE_SEND_VEC */ | 828 | #endif /* MHD_VECT_SEND */ |
833 | 829 | ||
834 | mhd_assert ( (NULL != body) || (0 == body_size) ); | 830 | mhd_assert ( (NULL != body) || (0 == body_size) ); |
835 | 831 | ||
@@ -866,7 +862,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection, | |||
866 | push_hdr = true; /* The header alone is equal to the whole response. */ | 862 | push_hdr = true; /* The header alone is equal to the whole response. */ |
867 | 863 | ||
868 | if ( | 864 | if ( |
869 | #ifdef _MHD_USE_SEND_VEC | 865 | #ifdef MHD_VECT_SEND |
870 | (no_vec) || | 866 | (no_vec) || |
871 | (0 == body_size) || | 867 | (0 == body_size) || |
872 | ((size_t) SSIZE_MAX <= header_size) || | 868 | ((size_t) SSIZE_MAX <= header_size) || |
@@ -874,9 +870,9 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection, | |||
874 | #ifdef _WIN32 | 870 | #ifdef _WIN32 |
875 | || ((size_t) UINT_MAX < header_size) | 871 | || ((size_t) UINT_MAX < header_size) |
876 | #endif /* _WIN32 */ | 872 | #endif /* _WIN32 */ |
877 | #else /* ! _MHD_USE_SEND_VEC */ | 873 | #else /* ! MHD_VECT_SEND */ |
878 | true | 874 | true |
879 | #endif /* ! _MHD_USE_SEND_VEC */ | 875 | #endif /* ! MHD_VECT_SEND */ |
880 | ) | 876 | ) |
881 | { | 877 | { |
882 | ret = MHD_send_data_ (connection, | 878 | ret = MHD_send_data_ (connection, |
@@ -915,7 +911,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection, | |||
915 | } | 911 | } |
916 | return ret; | 912 | return ret; |
917 | } | 913 | } |
918 | #ifdef _MHD_USE_SEND_VEC | 914 | #ifdef MHD_VECT_SEND |
919 | 915 | ||
920 | if ( ((size_t) SSIZE_MAX <= body_size) || | 916 | if ( ((size_t) SSIZE_MAX <= body_size) || |
921 | ((size_t) SSIZE_MAX < (header_size + body_size)) ) | 917 | ((size_t) SSIZE_MAX < (header_size + body_size)) ) |
@@ -1040,10 +1036,10 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection, | |||
1040 | } | 1036 | } |
1041 | 1037 | ||
1042 | return ret; | 1038 | return ret; |
1043 | #else /* ! _MHD_USE_SEND_VEC */ | 1039 | #else /* ! MHD_VECT_SEND */ |
1044 | mhd_assert (false); | 1040 | mhd_assert (false); |
1045 | return MHD_ERR_CONNRESET_; /* Unreachable. Mute warnings. */ | 1041 | return MHD_ERR_CONNRESET_; /* Unreachable. Mute warnings. */ |
1046 | #endif /* ! _MHD_USE_SEND_VEC */ | 1042 | #endif /* ! MHD_VECT_SEND */ |
1047 | } | 1043 | } |
1048 | 1044 | ||
1049 | 1045 | ||