From e61b2dd45d6fc6be5b37b993bb032e4fd0835e78 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 2 Feb 2018 11:07:52 +0300 Subject: [PATCH] Define macro to specify the environment file name extension (Win32/WinCE) (code refactoring) * misc.c [GC_READ_ENV_FILE] (GC_ENV_FILE_EXT): New macro. * misc.c [GC_READ_ENV_FILE && (MSWIN32 || MSWINCE || CYGWIN32)] (GC_envfile_init): Use GC_ENV_FILE_EXT instead of ".gc.env". --- misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc.c b/misc.c index 11275ac..2af1f37 100644 --- a/misc.c +++ b/misc.c @@ -634,6 +634,8 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size, # define GC_ENVFILE_MAXLEN 0x4000 # endif +# define GC_ENV_FILE_EXT ".gc.env" + /* The routine initializes GC_envfile_content from the GC "env" file. */ STATIC void GC_envfile_init(void) { @@ -650,7 +652,7 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size, if (len > 4 && path[len - 4] == (TCHAR)'.') { len -= 4; /* strip executable file extension */ } - BCOPY(TEXT(".gc.env"), &path[len], sizeof(TEXT(".gc.env"))); + BCOPY(TEXT(GC_ENV_FILE_EXT), &path[len], sizeof(TEXT(GC_ENV_FILE_EXT))); hFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL /* lpSecurityAttributes */, OPEN_EXISTING, -- 2.7.4