chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH 1/1] Include <windows.h> directly from chicken.


From: Evan Hanson
Subject: [Chicken-hackers] [PATCH 1/1] Include <windows.h> directly from chicken.h for access to Sleep()
Date: Wed, 1 Mar 2017 22:59:47 +1300

As of 0493e29 we always need access to Sleep() on Windows because it's
used in the "C_process_sleep" macro, so this includes <windows.h> early
in chicken.h rather than in runtime.c. It also drops a redundant include
from setup-api.scm, which uses the same #ifdef conditional as a guard.
---
 chicken.h     | 7 +++++++
 runtime.c     | 6 ------
 setup-api.scm | 1 -
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/chicken.h b/chicken.h
index b53fe44c..d843b0d4 100644
--- a/chicken.h
+++ b/chicken.h
@@ -154,6 +154,13 @@
 # include <malloc.h>
 #endif
 
+#if defined(_WIN32) && !defined(__CYGWIN__)
+/* Include winsock2 to get select() for check_fd_ready() */
+# include <winsock2.h>
+/* Include windows.h for Sleep() in C_process_sleep() */
+# include <windows.h>
+#endif
+
 /* Much better with stack allocation API */
 
 #ifdef HAVE_ALLOCA_H
diff --git a/runtime.c b/runtime.c
index a3298810..b7ed18d2 100644
--- a/runtime.c
+++ b/runtime.c
@@ -112,12 +112,6 @@ static C_TLS int timezone;
 # define RTLD_LAZY                     0
 #endif
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
-/* Include winsock2 to get select() for check_fd_ready() */
-# include <winsock2.h>
-# include <windows.h>
-#endif
-
 /* For image_info retrieval */
 #if defined(__HAIKU__)
 # include <kernel/image.h>
diff --git a/setup-api.scm b/setup-api.scm
index ef1f3c14..a0d91dbe 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -672,7 +672,6 @@
 
 #>
 #if defined(_WIN32) && !defined(__CYGWIN__)
-# include <windows.h>
 # define C_HAS_MESSAGE_BOX 1
 static int
 C_confirmation_dialog(char *msg, char *caption, int def, int abort)
-- 
2.11.0




reply via email to

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