commit c658010707f6fc8a97b095584b55d842bc9faba9
parent 82ff096dd4ceda1177bc925c3d6845998e692590
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Fri, 6 May 2022 15:19:18 +0300
MHD_get_master(): moved to the header, simplified
There is no need to support more than one level of 'master' daemon.
Diffstat:
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -219,22 +219,6 @@ MHD_free (void *ptr)
/**
- * Trace up to and return master daemon. If the supplied daemon
- * is a master, then return the daemon itself.
- *
- * @param daemon handle to a daemon
- * @return master daemon handle
- */
-static struct MHD_Daemon *
-MHD_get_master (struct MHD_Daemon *daemon)
-{
- while (NULL != daemon->master)
- daemon = daemon->master;
- return daemon;
-}
-
-
-/**
* Maintain connection count for single address.
*/
struct MHD_IPCount
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
@@ -2441,3 +2441,25 @@ void
internal_suspend_connection_ (struct MHD_Connection *connection);
#endif
+
+
+/**
+ * Trace up to and return master daemon. If the supplied daemon
+ * is a master, then return the daemon itself.
+ *
+ * @param daemon handle to a daemon
+ * @return master daemon handle
+ */
+_MHD_static_inline struct MHD_Daemon *
+MHD_get_master (struct MHD_Daemon *const daemon)
+{
+ struct MHD_Daemon *ret;
+
+ if (NULL != daemon->master)
+ ret = daemon->master;
+ else
+ ret = daemon;
+ mhd_assert (NULL == ret->master);
+
+ return ret;
+}