commit 9c46ac5e7d4b9d3072049d92795c8ae6a52b206e
parent 1582b5c79bb8c136d082a8162ef8ffc050fc8a78
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sat, 28 Feb 2026 17:06:55 +0100
Simplified and de-duplicated internal macros
Diffstat:
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/src/mhd2/conn_data_process.c b/src/mhd2/conn_data_process.c
@@ -133,7 +133,7 @@ mhd_conn_process_recv_send_data (struct MHD_Connection *restrict c)
sending (therefore "send-ready" was explicitly checked by sockets polling
call). */
send_ready_state_known =
- ((mhd_D_IS_USING_EDGE_TRIG (c->daemon)) ||
+ ((mhd_D_HAS_EDGE_TRIGG (c->daemon)) ||
(0 != (MHD_EVENT_LOOP_INFO_SEND & c->event_loop_info)));
has_sock_err =
(0 != (mhd_SOCKET_NET_STATE_ERROR_READY & c->sk.ready));
diff --git a/src/mhd2/daemon_start.c b/src/mhd2/daemon_start.c
@@ -1579,7 +1579,7 @@ daemon_init_net (struct MHD_Daemon *restrict d,
{
if ((MHD_INVALID_SOCKET != d->net.listen.fd)
&& ! d->net.listen.non_block
- && (mhd_D_IS_USING_EDGE_TRIG (d) ||
+ && (mhd_D_HAS_EDGE_TRIGG (d) ||
mhd_WM_INT_IS_THREAD_POOL (d->wmode_int)))
{
mhd_LOG_MSG (d, MHD_SC_LISTEN_SOCKET_NONBLOCKING_FAILURE, \
diff --git a/src/mhd2/mhd_daemon.h b/src/mhd2/mhd_daemon.h
@@ -261,6 +261,9 @@ enum MHD_FIXED_ENUM_ mhd_IntPollType
# define mhd_POLL_TYPE_INT_IS_EPOLL(poll_type) (0)
#endif
+#define mhd_POLL_TYPE_INT_IS_EDGE_TRIG(poll_type) \
+ mhd_POLL_TYPE_INT_IS_EPOLL (poll_type)
+
#if defined(HAVE_UINTPTR_T)
typedef uintptr_t mhd_SockRelMarker;
#else
@@ -1415,19 +1418,18 @@ struct MHD_Daemon
# define mhd_FD_FITS_DAEMON(d_ptr,fd) (! 0)
#endif
-#ifdef MHD_SUPPORT_EPOLL
-# define mhd_D_IS_USING_EPOLL(d) \
- (mhd_POLL_TYPE_EPOLL == ((d)->events.poll_type))
-#else
-# define mhd_D_IS_USING_EPOLL(d) (0)
-#endif
+#define mhd_D_IS_USING_EPOLL(d) \
+ mhd_POLL_TYPE_INT_IS_EPOLL ((d)->events.poll_type)
+
+#define mhd_D_POLL_IS_EDGE_TRIG(d) \
+ mhd_POLL_TYPE_INT_IS_EDGE_TRIG ((d)->events.poll_type)
/**
* Check whether the daemon has edge-triggered sockets polling
*/
#define mhd_D_HAS_EDGE_TRIGG(d) \
((mhd_WM_INT_EXTERNAL_EVENTS_EDGE == (d)->wmode_int) || \
- mhd_D_IS_USING_EPOLL (d))
+ mhd_D_POLL_IS_EDGE_TRIG (d))
#ifdef MHD_SUPPORT_THREADS
# define mhd_D_HAS_THREADS(d) mhd_WM_INT_HAS_THREADS ((d)->wmode_int)
@@ -1456,10 +1458,6 @@ struct MHD_Daemon
#define mhd_D_IS_INTERNAL_ONLY(d) \
mhd_D_TYPE_IS_INTERNAL_ONLY ((d)->threading.d_type)
-#define mhd_D_IS_USING_EDGE_TRIG(d) \
- (mhd_D_IS_USING_EPOLL (d) || \
- (mhd_WM_INT_EXTERNAL_EVENTS_EDGE ==((d)->wmode_int)))
-
#ifdef MHD_SUPPORT_HTTPS
/**
* Returns non-zero if daemon has TLS enabled or zero otherwise