/* Allowed type of the variable */
e_xbt_cfgelm_type_t type;
int min, max;
- int isdefault:1;
+ unsigned isdefault:1;
/* Callbacks */
xbt_cfg_cb_t cb_set;
xbt_cfg_t xbt_cfg_new(void)
{
- return (xbt_cfg_t) xbt_dict_new();
+ return (xbt_cfg_t) xbt_dict_new_homogeneous(&xbt_cfgelm_free);
}
/** \brief Copy an existing configuration set
*cfg = xbt_cfg_new();
xbt_assert(type >= xbt_cfgelm_int && type <= xbt_cfgelm_peer,
"type of %s not valid (%d should be between %d and %d)",
- name, type, xbt_cfgelm_int, xbt_cfgelm_peer);
+ name, (int)type, xbt_cfgelm_int, xbt_cfgelm_peer);
res = xbt_dict_get_or_null((xbt_dict_t) * cfg, name);
if (res) {
res = xbt_new(s_xbt_cfgelm_t, 1);
XBT_DEBUG("Register cfg elm %s (%s) (%d to %d %s (=%d) @%p in set %p)",
- name, desc, min, max, xbt_cfgelm_type_name[type], type, res,
+ name, desc, min, max, xbt_cfgelm_type_name[type], (int)type, res,
*cfg);
res->desc = xbt_strdup(desc);
break;
default:
- XBT_ERROR("%d is an invalide type code", type);
+ XBT_ERROR("%d is an invalide type code", (int)type);
}
- xbt_dict_set((xbt_dict_t) * cfg, name, res, &xbt_cfgelm_free);
+ xbt_dict_set((xbt_dict_t) * cfg, name, res, NULL);
}
/** @brief Unregister an element from a config set.
"; Should be <name>:<min nb>_to_<max nb>_<type>");
tok++;
- for (type = 0;
+ for (type = (e_xbt_cfgelm_type_t)0;
type < xbt_cfgelm_type_count
&& strcmp(tok, xbt_cfgelm_type_name[type]); type++);
xbt_assert(type < xbt_cfgelm_type_count,
"Can't get the type of '%s' since this variable does not exist",
name);
- XBT_INFO("type in variable = %d", variable->type);
+ XBT_INFO("type in variable = %d", (int)variable->type);
return variable->type;
}
char *str;
int i;
double d;
- e_xbt_cfgelm_type_t type = 0; /* Set a dummy value to make gcc happy. It cannot get uninitialized */
+ e_xbt_cfgelm_type_t type = xbt_cfgelm_any; /* Set a dummy value to make gcc happy. It cannot get uninitialized */
xbt_ex_t e;
break;
default:
- xbt_die("Config element variable %s not valid (type=%d)", name, type);
+ xbt_die("Config element variable %s not valid (type=%d)", name, (int)type);
}
}
int len;
- XBT_IN("");
+ XBT_IN();
if (!options || !strlen(options)) { /* nothing to do */
return;
}
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
XBT_DEBUG("Variable: %d to %d %s (=%d) @%p",
variable->min, variable->max,
- xbt_cfgelm_type_name[variable->type], variable->type, variable);
+ xbt_cfgelm_type_name[variable->type], (int)variable->type, variable);
if (variable->max == 1) {
if (!xbt_dynar_is_empty(variable->content)) {
#include "xbt.h"
#include "xbt/ex.h"
-XBT_LOG_EXTERNAL_CATEGORY(xbt_cfg);
-XBT_LOG_DEFAULT_CATEGORY(xbt_cfg);
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_cfg);
XBT_TEST_SUITE("config", "Configuration support");