]> 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:10:11 +0000 (20:10 +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 1fece0f6e63dc8199ac39df795d14e012e5aa199..841689e3c977b00f71a2129429ff233b348fd008 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
@@ -500,6 +501,11 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size,
 # endif
 #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;
@@ -1149,10 +1155,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)
   {
     HANDLE hFile;