summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-14 09:33:20 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-05-14 09:33:20 +0900
commit7cf90f99f5674fdadc0ff9d8341b315b2490ea26 (patch)
tree39d4e1992719680e2ebaf23fd10d6c76bfa0ded6 /gc.c
parenta168c4772827bc6105177c4b605dcf6e6e1943a5 (diff)
Refix PAGE_SIZE
* honor actually used headers * include sys/user.h only when `PAGE_SIZE` is not defined
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gc.c b/gc.c
index 365210b377..8b36b6c2f1 100644
--- a/gc.c
+++ b/gc.c
@@ -32,6 +32,7 @@
#include <stdarg.h>
#include <stdio.h>
+/* MALLOC_HEADERS_BEGIN */
#ifndef HAVE_MALLOC_USABLE_SIZE
# ifdef _WIN32
# define HAVE_MALLOC_USABLE_SIZE
@@ -54,6 +55,12 @@
# endif
#endif
+#if !defined(PAGE_SIZE) && defined(HAVE_SYS_USER_H)
+/* LIST_HEAD conflicts with sys/queue.h on macOS */
+# include <sys/user.h>
+#endif
+/* MALLOC_HEADERS_END */
+
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
@@ -71,10 +78,6 @@
#include <sys/types.h>
-#ifdef HAVE_SYS_USER_H
-# include <sys/user.h>
-#endif
-
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif