XBT_DEBUG("Do not override configuration variable '%s' with value '%s' because it was already set.", name, val);
}
-/** @brief Set or add an integer value to \a name within \a cfg
+/** @brief Set an integer value to \a name within \a cfg
*
- * @param cfg the config set
* @param name the name of the variable
* @param val the value of the variable
*/
xbt_dynar_set(variable->content, 0, &val);
if (variable->cb_set)
- variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
+ variable->cb_set(name);
variable->isdefault = 0;
}
/** @brief Set or add a double value to \a name within \a cfg
*
- * @param cfg the config set
* @param name the name of the variable
- * @param val the doule to set
+ * @param val the double to set
*/
void xbt_cfg_set_double(const char *name, double val)
{
xbt_dynar_set(variable->content, 0, &val);
if (variable->cb_set)
- variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
+ variable->cb_set(name);
variable->isdefault = 0;
}
xbt_dynar_set(variable->content, 0, &newval);
if (variable->cb_set)
- variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
+ variable->cb_set(name);
variable->isdefault = 0;
}
*/
void xbt_cfg_set_boolean(const char *name, const char *val)
{
- int i, bval;
+ int bval=-1;
xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_boolean);
- for (i = 0; xbt_cfgelm_boolean_values[i].true_val != NULL; i++) {
+ for (int i = 0; xbt_cfgelm_boolean_values[i].true_val != NULL; i++) {
if (strcmp(val, xbt_cfgelm_boolean_values[i].true_val) == 0){
bval = 1;
break;
break;
}
}
- if (xbt_cfgelm_boolean_values[i].true_val == NULL) {
- xbt_die("Value of option '%s' not valid. Should be a boolean (yes,no,on,off,true,false,0,1)", val);
- }
-
+ xbt_assert(bval != -1, "Value of option '%s' not valid. Should be a boolean (yes,no,on,off,true,false,0,1)", val);
xbt_dynar_set(variable->content, 0, &bval);
if (variable->cb_set)
- variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
+ variable->cb_set(name);
variable->isdefault = 0;
}