]> granicus.if.org Git - gc/commitdiff
Fix GC_READ_ENV_FILE code for Cygwin
authorIvan Maidanski <ivmai@mail.ru>
Tue, 6 Mar 2012 16:10:11 +0000 (20:10 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 6 Mar 2012 16:11:56 +0000 (20:11 +0400)
* misc.c: Include windows.h for Cygwin if GC_READ_ENV_FILE (required
for GC_envfile_init).
* misc.c (_MAX_PATH): Move definition to the place before the first
use (only Win32).

misc.c

diff --git a/misc.c b/misc.c
index 8db6085124bdf2b72c887a0005c0d290f76f77a7..63b9d477861e27534a952e2150e9f00d52a373b7 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -26,7 +26,8 @@
 #ifdef GC_SOLARIS_THREADS
 # include <sys/syscall.h>
 #endif
-#if defined(MSWIN32) || defined(MSWINCE)
+#if defined(MSWIN32) || defined(MSWINCE) \
+    || (defined(CYGWIN32) && defined(GC_READ_ENV_FILE))
 # ifndef WIN32_LEAN_AND_MEAN
 #   define WIN32_LEAN_AND_MEAN 1
 # endif
@@ -466,6 +467,11 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size,
   }
 #endif /* THREADS */
 
+#if !defined(_MAX_PATH) && (defined(MSWIN32) || defined(MSWINCE) \
+                            || defined(CYGWIN32))
+# define _MAX_PATH MAX_PATH
+#endif
+
 #ifdef GC_READ_ENV_FILE
   /* This works for Win32/WinCE for now.  Really useful only for WinCE. */
   STATIC char *GC_envfile_content = NULL;
@@ -1108,10 +1114,6 @@ GC_API void GC_CALL GC_enable_incremental(void)
 #   define IF_NEED_TO_LOCK(x)
 # endif /* !THREADS */
 
-# ifndef _MAX_PATH
-#   define _MAX_PATH MAX_PATH
-# endif
-
   STATIC HANDLE GC_CreateLogFile(void)
   {
 #   if !defined(NO_GETENV_WIN32) || !defined(OLD_WIN32_LOG_FILE)