/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <stdio.h>
#include "xbt/misc.h"
#include "xbt/sysdep.h"
#include "xbt/log.h"
xbt_dynar_set(variable->content,0,&val);
} else {
- if (variable->max && xbt_dynar_length(variable->content) == variable->max)
+ if (variable->max && xbt_dynar_length(variable->content) == (unsigned long)variable->max)
THROW3(mismatch_error,0,
"Cannot add value %d to the config element %s since it's already full (size=%d)",
val,name,variable->max);
variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
if (variable->max == 1) {
- if (variable->cb_rm && xbt_dynar_length(variable->content))
- (*variable->cb_rm)(name, 0);
+ if (xbt_dynar_length(variable->content)) {
+ if (variable->cb_rm)
+ (*variable->cb_rm)(name, 0);
+ else if (variable->type == xbt_cfgelm_string) {
+ char * sval=xbt_dynar_get_as(variable->content,0,char*);
+ free(sval);
+ }
+ }
xbt_dynar_set(variable->content,0,&newval);
} else {
}
XBT_TEST_UNIT("use",test_config_use,"Data retrieving tests") {
- xbt_cfg_t set = set=make_set();
-
xbt_test_add0("Get a single value");
{