Bläddra i källkod

added raw block size as environmental variable option

Ioannis Koutras 12 år sedan
förälder
incheckning
3e49b632b5
1 ändrade filer med 11 tillägg och 0 borttagningar
  1. 11 0
      src/parse_env.c

+ 11 - 0
src/parse_env.c

@@ -22,6 +22,7 @@
  * @brief  Parse the DMMLIB_OPTS enviroment variable.
  */
 
+#include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -66,6 +67,16 @@ void parse_env(void) {
     }
 #endif /* WITH_DEBUG */
 
+    env = getenv("DMMLIB_SYSALLOC_SZ");
+
+    if(env != NULL) {
+        char *end;
+        uintmax_t num = strtoumax(env, &end, 10);
+        if(num != UINTMAX_MAX) {
+            systemallocator.dmm_knobs.sys_alloc_size = (double) num;
+        }
+    }
+
     systemallocator.initialized = true;
 
     return;