aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-04-04 12:14:35 +0100
committerfanquake <fanquake@gmail.com>2024-06-21 09:42:32 +0100
commit40cd7585a042938937b5964c9c264e2bf4a80742 (patch)
treed1dcfb0dd0fd3909498f14444de96a6a82a30b30
parent7839503b309c107e8229475a8fbf66601b0e7e8e (diff)
randomenv: use ifdef over if
randomenv.cpp:48:5: warning: 'HAVE_VM_VM_PARAM_H' is not defined, evaluates to 0 [-Wundef] randomenv.cpp:51:5: warning: 'HAVE_SYS_RESOURCES_H' is not defined, evaluates to 0 [-Wundef] randomenv.cpp:424:5: error: 'HAVE_SYSCTL' is not defined, evaluates to 0 [-Werror,-Wundef]
-rw-r--r--src/randomenv.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/randomenv.cpp b/src/randomenv.cpp
index aeec959c28..49033deef2 100644
--- a/src/randomenv.cpp
+++ b/src/randomenv.cpp
@@ -42,15 +42,15 @@
#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
#include <ifaddrs.h>
#endif
-#if HAVE_SYSCTL
+#ifdef HAVE_SYSCTL
#include <sys/sysctl.h>
-#if HAVE_VM_VM_PARAM_H
+#ifdef HAVE_VM_VM_PARAM_H
#include <vm/vm_param.h>
#endif
-#if HAVE_SYS_RESOURCES_H
+#ifdef HAVE_SYS_RESOURCES_H
#include <sys/resources.h>
#endif
-#if HAVE_SYS_VMMETER_H
+#ifdef HAVE_SYS_VMMETER_H
#include <sys/vmmeter.h>
#endif
#endif
@@ -162,7 +162,7 @@ void AddPath(CSHA512& hasher, const char *path)
}
#endif
-#if HAVE_SYSCTL
+#ifdef HAVE_SYSCTL
template<int... S>
void AddSysctl(CSHA512& hasher)
{
@@ -274,7 +274,7 @@ void RandAddDynamicEnv(CSHA512& hasher)
AddFile(hasher, "/proc/self/status");
#endif
-#if HAVE_SYSCTL
+#ifdef HAVE_SYSCTL
# ifdef CTL_KERN
# if defined(KERN_PROC) && defined(KERN_PROC_ALL)
AddSysctl<CTL_KERN, KERN_PROC, KERN_PROC_ALL>(hasher);
@@ -419,7 +419,7 @@ void RandAddStaticEnv(CSHA512& hasher)
// For MacOS/BSDs, gather data through sysctl instead of /proc. Not all of these
// will exist on every system.
-#if HAVE_SYSCTL
+#ifdef HAVE_SYSCTL
# ifdef CTL_HW
# ifdef HW_MACHINE
AddSysctl<CTL_HW, HW_MACHINE>(hasher);