X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/da25148eac65bb09ab1ef88fb0c3182d784e5732..2c8c164d58104acb6256b6d8efd476a6a2165b8a:/src/xbt/config.c diff --git a/src/xbt/config.c b/src/xbt/config.c index aeb7baabf5..b78bdfb7fa 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -212,8 +212,7 @@ void xbt_cfgelm_free(void *data) * @param cb_rm callback function called when a value is removed */ -void -xbt_cfg_register(xbt_cfg_t * cfg, +void xbt_cfg_register(xbt_cfg_t * cfg, const char *name, const char *desc, e_xbt_cfgelm_type_t type, int min, int max, xbt_cfg_cb_t cb_set, xbt_cfg_cb_t cb_rm) @@ -341,11 +340,6 @@ void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry) free(entrycpy); /* strdup'ed by dict mechanism, but cannot be const */ } -static int strcmp_voidp(const void *pa, const void *pb) -{ - return strcmp(*(const char **)pa, *(const char **)pb); -} - /** @brief Displays the declared options and their description */ void xbt_cfg_help(xbt_cfg_t cfg) { @@ -358,7 +352,7 @@ void xbt_cfg_help(xbt_cfg_t cfg) xbt_dict_foreach((xbt_dict_t )cfg, dict_cursor, name, variable) { xbt_dynar_push(names, &name); } - xbt_dynar_sort(names, strcmp_voidp); + xbt_dynar_sort_strings(names); xbt_dynar_foreach(names, dynar_cursor, name) { int i; @@ -933,14 +927,14 @@ void xbt_cfg_set_boolean(xbt_cfg_t cfg, const char *name, const char *val) variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_boolean); for (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; - } - if (strcmp(val, xbt_cfgelm_boolean_values[i].false_val) == 0){ - bval = 0; - break; - } + if (strcmp(val, xbt_cfgelm_boolean_values[i].true_val) == 0){ + bval = 1; + break; + } + if (strcmp(val, xbt_cfgelm_boolean_values[i].false_val) == 0){ + bval = 0; + 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);