libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] [PATCH] use ifdef for several HAVE header macros


From: Rosen Penev
Subject: [libmicrohttpd] [PATCH] use ifdef for several HAVE header macros
Date: Fri, 1 Apr 2022 21:14:53 -0700

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 src/include/platform.h    | 18 +++++++++---------
 src/lib/daemon_ip_limit.c |  6 +++---
 src/lib/daemon_options.c  |  2 +-
 src/lib/daemon_start.c    | 10 +++++-----
 src/lib/mhd_byteorder.h   | 18 +++++++++---------
 src/lib/sysfdsetsize.c    | 10 +++++-----
 6 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/include/platform.h b/src/include/platform.h
index b5861d25..4376636e 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -70,32 +70,32 @@
 #endif /* HAVE_INETLIB_H */
 #endif /* __VXWORKS__ */
 
-#if HAVE_MEMORY_H
+#ifdef HAVE_MEMORY_H
 #include <memory.h>
 #endif
 
-#if HAVE_SYS_SELECT_H
+#ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
-#if HAVE_SYS_TIME_H
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
-#if HAVE_SYS_MSG_H
+#ifdef HAVE_SYS_MSG_H
 #include <sys/msg.h>
 #endif
-#if HAVE_SYS_MMAN_H
+#ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
-#if HAVE_TIME_H
+#ifdef HAVE_TIME_H
 #include <time.h>
 #endif
-#if HAVE_SYS_SOCKET_H
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
 #if defined(_WIN32) && ! defined(__CYGWIN__)
diff --git a/src/lib/daemon_ip_limit.c b/src/lib/daemon_ip_limit.c
index e8af56d8..91fc06ea 100644
--- a/src/lib/daemon_ip_limit.c
+++ b/src/lib/daemon_ip_limit.c
@@ -24,7 +24,7 @@
  */
 #include "internal.h"
 #include "daemon_ip_limit.h"
-#if HAVE_SEARCH_H
+#ifdef HAVE_SEARCH_H
 #include <search.h>
 #else
 #include "tsearch.h"
@@ -50,7 +50,7 @@ struct MHD_IPCount
      * IPv4 address.
      */
     struct in_addr ipv4;
-#if HAVE_INET6
+#ifdef HAVE_INET6
     /**
      * IPv6 address.
      */
@@ -154,7 +154,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
     return MHD_YES;
   }
 
-#if HAVE_INET6
+#ifdef HAVE_INET6
   /* IPv6 addresses */
   if (sizeof (struct sockaddr_in6) == addrlen)
   {
diff --git a/src/lib/daemon_options.c b/src/lib/daemon_options.c
index abf1fbd3..531e4222 100644
--- a/src/lib/daemon_options.c
+++ b/src/lib/daemon_options.c
@@ -23,7 +23,7 @@
  * @author Christian Grothoff
  */
 #include "internal.h"
-#if HAVE_DLFCN_H
+#ifdef HAVE_DLFCN_H
 #include <dlfcn.h>
 #endif
 
diff --git a/src/lib/daemon_start.c b/src/lib/daemon_start.c
index e2998f9d..be3191da 100644
--- a/src/lib/daemon_start.c
+++ b/src/lib/daemon_start.c
@@ -199,7 +199,7 @@ open_listen_socket (struct MHD_Daemon *daemon)
     } /* switch on ss_family */
     break;   /* MHD_AF_NONE */
   case MHD_AF_AUTO:
-#if HAVE_INET6
+#ifdef HAVE_INET6
     pf = PF_INET6;
     use_v6 = true;
 #else
@@ -213,7 +213,7 @@ open_listen_socket (struct MHD_Daemon *daemon)
     break;
   case MHD_AF_INET6:
   case MHD_AF_DUAL:
-#if HAVE_INET6
+#ifdef HAVE_INET6
     pf = PF_INET6;
     use_v6 = true;
     break;
@@ -296,7 +296,7 @@ try_open_listen_socket:
   else
   {
     /* Compute bind address based on port and AF */
-#if HAVE_INET6
+#ifdef HAVE_INET6
     if (use_v6)
     {
 #ifdef IN6ADDR_ANY_INIT
@@ -633,7 +633,7 @@ MHD_polling_thread (void *cls)
                           MHD_YES);
       break;
     case MHD_ELS_POLL:
-#if HAVE_POLL
+#ifdef HAVE_POLL
       MHD_daemon_poll_ (daemon,
                         MHD_YES);
 #else
@@ -834,7 +834,7 @@ MHD_daemon_start (struct MHD_Daemon *daemon)
       daemon->event_loop_syscall = MHD_ELS_POLL;
     else
       daemon->event_loop_syscall = MHD_ELS_EPOLL;
-#elif HAVE_POLL
+#elif defined(HAVE_POLL)
     daemon->event_loop_syscall = MHD_ELS_POLL;
 #else
     daemon->event_loop_syscall = MHD_ELS_SELECT;
diff --git a/src/lib/mhd_byteorder.h b/src/lib/mhd_byteorder.h
index 442e8e17..5e6d9727 100644
--- a/src/lib/mhd_byteorder.h
+++ b/src/lib/mhd_byteorder.h
@@ -28,39 +28,39 @@
 
 #include "platform.h"
 
-#if HAVE_ENDIAN_H
+#ifdef HAVE_ENDIAN_H
 #include <endian.h>
 #endif
 
-#if HAVE_SYS_PARAM_H
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
 
-#if HAVE_MACHINE_ENDIAN_H
+#ifdef HAVE_MACHINE_ENDIAN_H
 #include <machine/endian.h>
 #endif
 
-#if HAVE_SYS_ENDIAN_H
+#ifdef HAVE_SYS_ENDIAN_H
 #include <sys/endian.h>
 #endif
 
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 
-#if HAVE_SYS_BYTEORDER_H
+#ifdef HAVE_SYS_BYTEORDER_H
 #include <sys/byteorder.h>
 #endif
 
-#if HAVE_SYS_MACHINE_H
+#ifdef HAVE_SYS_MACHINE_H
 #include <sys/machine.h>
 #endif
 
-#if HAVE_MACHINE_PARAM_H
+#ifdef HAVE_MACHINE_PARAM_H
 #include <machine/param.h>
 #endif
 
-#if HAVE_SYS_ISA_DEFS_H
+#ifdef HAVE_SYS_ISA_DEFS_H
 #include <sys/isa_defs.h>
 #endif
 
diff --git a/src/lib/sysfdsetsize.c b/src/lib/sysfdsetsize.c
index 4929b3d2..350bfd5e 100644
--- a/src/lib/sysfdsetsize.c
+++ b/src/lib/sysfdsetsize.c
@@ -37,22 +37,22 @@
 #if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
 #include <sockLib.h>
 #endif /* OS_VXWORKS */
-#if HAVE_SYS_SELECT_H
+#ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif /* HAVE_SYS_TYPES_H */
-#if HAVE_SYS_TIME_H
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif /* HAVE_SYS_TIME_H */
-#if HAVE_TIME_H
+#ifdef HAVE_TIME_H
 #include <time.h>
 #endif /* HAVE_TIME_H */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
-#if HAVE_SYS_SOCKET_H
+#ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif /* HAVE_SYS_SOCKET_H */
 
-- 
2.35.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]