From 280fb849e0fa6524520c1dc7aed78e695ec29e8e Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 30 Nov 2021 16:20:33 +0300 Subject: Minor readability improvements --- src/examples/websocket_threaded_example.c | 6 +++--- src/microhttpd/daemon.c | 2 +- src/microhttpd/mhd_threads.h | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c index 3a232b41..3f94cbd8 100644 --- a/src/examples/websocket_threaded_example.c +++ b/src/examples/websocket_threaded_example.c @@ -420,9 +420,9 @@ is_websocket_request (struct MHD_Connection *con, const char *upg_header, (void) con; /* Unused. Silent compiler warning. */ - return (upg_header != NULL) && (con_header != NULL) - && (0 == strcmp (upg_header, WS_UPGRADE_VALUE)) - && (NULL != strstr (con_header, "Upgrade")) + return ((upg_header != NULL) && (con_header != NULL) + && (0 == strcmp (upg_header, WS_UPGRADE_VALUE)) + && (NULL != strstr (con_header, "Upgrade"))) ? MHD_YES : MHD_NO; } diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 25ac0969..9731bf72 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c @@ -2157,7 +2157,7 @@ thread_main_handle_connection (void *data) #else 1, #endif - (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0) + (NULL == tvp) ? -1 : (tv.tv_sec * 1000)) < 0) { if (MHD_SCKT_LAST_ERR_IS_ (MHD_SCKT_EINTR_)) continue; diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h index 14612ded..818cd5fa 100644 --- a/src/microhttpd/mhd_threads.h +++ b/src/microhttpd/mhd_threads.h @@ -150,10 +150,9 @@ typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_; * @param thread handle to watch * @return nonzero on success, zero otherwise */ -#define MHD_join_thread_(thread) (WAIT_OBJECT_0 == WaitForSingleObject ( \ - (thread), INFINITE) ? (CloseHandle ( \ - (thread)), ! 0) : \ - 0) +#define MHD_join_thread_(thread) \ + ( (WAIT_OBJECT_0 == WaitForSingleObject ( (thread), INFINITE)) ? \ + (CloseHandle ( (thread)), ! 0) : 0 ) #endif #if defined(MHD_USE_POSIX_THREADS) @@ -239,7 +238,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread, */ int MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread, - const char*thread_name, + const char *thread_name, size_t stack_size, MHD_THREAD_START_ROUTINE_ start_routine, void *arg); -- cgit v1.2.3