Browse Source

initialize statically the systemallocator variable even when parsing env variables

Ioannis Koutras 12 years ago
parent
commit
73968cf6e6
2 changed files with 6 additions and 3 deletions
  1. 5 0
      src/initialize.c
  2. 1 3
      src/parse_env.c

+ 5 - 0
src/initialize.c

@@ -60,5 +60,10 @@ allocator_t systemallocator =
         , 0
         }
 #endif /* WITH_ALLOCATOR_STATS */
+#ifdef PARSE_ENV
+#if defined  WITH_MEM_TRACE || defined WITH_STATS_TRACE || defined WITH_DEBUG
+    , .initialized = false
+#endif /* WITH_MEM_TRACE || WITH_STATS_TRACE || WITH_DEBUG */
+#endif /* PARSE_ENV */
 };
 

+ 1 - 3
src/parse_env.c

@@ -37,8 +37,6 @@ __attribute__((constructor)) void parse_env(void);
 void parse_env(void) {
     const char* env;
 
-    systemallocator.initialized = false;
-
 #ifdef WITH_MEM_TRACE
     env = getenv("DMMLIB_MEM_TRACE");
 
@@ -69,7 +67,7 @@ void parse_env(void) {
     }
 #endif /* WITH_DEBUG */
 
-   systemallocator.initialized = true;
+    systemallocator.initialized = true;
 
     return;
 }