X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d8888df4d713c0e6e23ce338e1adbc61a6d0421c..3429978465882f1a8d4911725dd65019e36eefed:/src/xbt/config.c diff --git a/src/xbt/config.c b/src/xbt/config.c index 8c91ca0110..e10dc0d647 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -53,7 +53,7 @@ static void xbt_cfg_str_free(void *d){ free(*(void**)d); } static void xbt_cfg_host_free(void *d){ - xbt_host_t *h=(xbt_host_t*) *(void**)d; + xbt_host_t h=(xbt_host_t) *(void**)d; if (h) { if (h->name) free(h->name); free(h); @@ -116,7 +116,7 @@ void xbt_cfg_dump(const char *name,const char *indent,xbt_cfg_t cfg) { int ival; char *sval; double dval; - xbt_host_t *hval; + xbt_host_t hval; if (name) printf("%s>> Dumping of the config set '%s':\n",indent,name); @@ -155,7 +155,7 @@ void xbt_cfg_dump(const char *name,const char *indent,xbt_cfg_t cfg) { case xbt_cfgelm_host: for (i=0; icontent,i,xbt_host_t*); + hval = xbt_dynar_get_as(variable->content,i,xbt_host_t); printf ("%s %s:%d\n",indent,hval->name,hval->port); } break; @@ -215,7 +215,7 @@ xbt_cfg_register(xbt_cfg_t cfg, } CATCH(e) { if (e.category == not_found_error) { found = 1; - xbt_ex_free(e); + xbt_ex_free(&e); } else { RETHROW; } @@ -248,7 +248,7 @@ xbt_cfg_register(xbt_cfg_t cfg, break; case xbt_cfgelm_host: - res->content = xbt_dynar_new(sizeof(xbt_host_t*),&xbt_cfg_host_free); + res->content = xbt_dynar_new(sizeof(xbt_host_t),&xbt_cfg_host_free); break; default: @@ -372,7 +372,7 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, res = xbt_dict_get((xbt_dict_t)cfg,name); } CATCH(e) { if (e.category == not_found_error) { - xbt_ex_free(e); + xbt_ex_free(&e); THROW1(not_found_error,0, "No registered variable '%s' in this config set",name); } @@ -406,7 +406,7 @@ xbt_cfg_get_type(xbt_cfg_t cfg, const char *name) { variable = xbt_dict_get((xbt_dict_t)cfg,name); } CATCH(e) { if (e.category == not_found_error) { - xbt_ex_free(e); + xbt_ex_free(&e); THROW1(not_found_error,0, "Can't get the type of '%s' since this variable does not exist",name); } @@ -440,7 +440,7 @@ xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa) { type = xbt_cfg_get_type(cfg,name); } CATCH(e) { if (e.category == not_found_error) { - xbt_ex_free(e); + xbt_ex_free(&e); THROW1(not_found_error,0,"Can't set the property '%s' since it's not registered",name); } RETHROW; @@ -579,7 +579,7 @@ xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) { name = (char*) (optionlist_cpy-name + options); free(optionlist_cpy); if (e.category == not_found_error) { - xbt_ex_free(e); + xbt_ex_free(&e); THROW1(not_found_error,0,"No registrated variable corresponding to '%s'.",name); } RETHROW; @@ -760,7 +760,7 @@ void xbt_cfg_set_host(xbt_cfg_t cfg,const char*name, const char *host,int port) { xbt_cfgelm_t variable; - xbt_host_t *val=xbt_new(xbt_host_t,1); + xbt_host_t val=xbt_new(s_xbt_host_t,1); VERB3("Configuration setting: %s=%s:%d",name,host,port); @@ -895,7 +895,7 @@ void xbt_cfg_rm_host(xbt_cfg_t cfg,const char*name, const char *host,int port) { xbt_cfgelm_t variable; int cpt; - xbt_host_t *seen; + xbt_host_t seen; variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_host); @@ -951,7 +951,7 @@ xbt_cfg_empty(xbt_cfg_t cfg,const char*name) { if (e.category != not_found_error) RETHROW; - xbt_ex_free(e); + xbt_ex_free(&e); THROW1(not_found_error,0, "Can't empty '%s' since this config element does not exist", name); } @@ -1060,7 +1060,7 @@ char* xbt_cfg_get_string(xbt_cfg_t cfg, const char *name) { void xbt_cfg_get_host (xbt_cfg_t cfg, const char *name, char **host, int *port) { xbt_cfgelm_t variable; - xbt_host_t *val; + xbt_host_t val; variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_host); @@ -1069,7 +1069,7 @@ void xbt_cfg_get_host (xbt_cfg_t cfg, const char *name, name, xbt_dynar_length(variable->content)); } - val = xbt_dynar_get_as(variable->content, 0, xbt_host_t*); + val = xbt_dynar_get_as(variable->content, 0, xbt_host_t); *host=val->name; *port=val->port; } @@ -1092,7 +1092,7 @@ xbt_dynar_t xbt_cfg_get_dynar (xbt_cfg_t cfg, const char *name) { variable = xbt_dict_get((xbt_dict_t)cfg,name); } CATCH(e) { if (e.category == not_found_error) { - xbt_ex_free(e); + xbt_ex_free(&e); THROW1(not_found_error,0, "No registered variable %s in this config set",name); } @@ -1134,7 +1134,7 @@ xbt_cfg_get_host_at(xbt_cfg_t cfg, const char *name, int pos, char **host, int *port) { xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int); - xbt_host_t *val = xbt_dynar_get_ptr(variable->content, pos); + xbt_host_t val = xbt_dynar_get_ptr(variable->content, pos); *port = val->port; *host = val->name; @@ -1178,7 +1178,7 @@ XBT_TEST_UNIT("validation",test_config_validation,"Validation tests") { if (e.category != mismatch_error || strncmp(e.msg,"Config elem speed needs",strlen("Config elem speed needs"))) xbt_test_fail1("Got an exception. msg=%s",e.msg); - xbt_ex_free(e); + xbt_ex_free(&e); } xbt_cfg_free(&set); xbt_cfg_free(&set); @@ -1195,7 +1195,7 @@ XBT_TEST_UNIT("validation",test_config_validation,"Validation tests") { strncmp(e.msg,"Cannot add value 34 to the config elem speed", strlen("Config elem speed needs"))) xbt_test_fail1("Got an exception. msg=%s",e.msg); - xbt_ex_free(e); + xbt_ex_free(&e); } xbt_cfg_check(set); xbt_cfg_free(&set); @@ -1256,7 +1256,7 @@ XBT_TEST_UNIT("use",test_config_use,"Data retrieving tests") { } CATCH(e) { if (e.category != not_found_error) xbt_test_exception(e); - xbt_ex_free(e); + xbt_ex_free(&e); } xbt_cfg_free(&myset); }