Explorar o código

initialize statically the systemallocator variable even when parsing env variables

Ioannis Koutras %!s(int64=12) %!d(string=hai) anos
pai
achega
73968cf6e6
Modificáronse 2 ficheiros con 6 adicións e 3 borrados
  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;
 }