Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Pcre for fedora.
[simgrid.git] / src / xbt / config.c
index 67f2e4c..456f47d 100644 (file)
@@ -636,7 +636,8 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
     }
     *(val++) = '\0';
 
-    DEBUG2("Configuration change: Set '%s' to '%s'", name, val);
+    if (strcmp(name,"contexts/factory"))
+      INFO2("Configuration change: Set '%s' to '%s'", name, val);
 
     TRY {
       variable = xbt_dict_get((xbt_dict_t) cfg, name);
@@ -728,9 +729,11 @@ void xbt_cfg_setdefault_int(xbt_cfg_t cfg, const char *name, int val)
 {
   xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
 
-  if (variable->isdefault)
+  if (variable->isdefault){
     xbt_cfg_set_int(cfg, name, val);
-  else
+    variable->isdefault = 1;
+  }
+   else
     DEBUG2
         ("Do not override configuration variable '%s' with value '%d' because it was already set.",
          name, val);
@@ -745,8 +748,10 @@ void xbt_cfg_setdefault_double(xbt_cfg_t cfg, const char *name, double val)
 {
   xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
 
-  if (variable->isdefault)
+  if (variable->isdefault) {
     xbt_cfg_set_double(cfg, name, val);
+    variable->isdefault = 1;
+  }
   else
     DEBUG2
         ("Do not override configuration variable '%s' with value '%lf' because it was already set.",
@@ -763,8 +768,10 @@ void xbt_cfg_setdefault_string(xbt_cfg_t cfg, const char *name,
 {
   xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
 
-  if (variable->isdefault)
+  if (variable->isdefault){
     xbt_cfg_set_string(cfg, name, val);
+    variable->isdefault = 1;
+  }
   else
     DEBUG2
         ("Do not override configuration variable '%s' with value '%s' because it was already set.",
@@ -781,8 +788,10 @@ void xbt_cfg_setdefault_peer(xbt_cfg_t cfg, const char *name,
 {
   xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer);
 
-  if (variable->isdefault)
+  if (variable->isdefault){
     xbt_cfg_set_peer(cfg, name, host, port);
+    variable->isdefault = 1;
+  }
   else
     DEBUG3
         ("Do not override configuration variable '%s' with value '%s:%d' because it was already set.",
@@ -1136,6 +1145,14 @@ void xbt_cfg_empty(xbt_cfg_t cfg, const char *name)
     xbt_dynar_reset(variable->content);
   }
 }
+/*
+ * Say if the value is the default value
+ */
+int xbt_cfg_is_default_value(xbt_cfg_t cfg, const char *name)
+{
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_any);
+  return variable->isdefault;
+}
 
 /*----[ Getting ]---------------------------------------------------------*/