void xbt_cfg_host_free(void *d);
void xbt_cfg_str_free(void *d){
- xbt_free(*(void**)d);
+ free(*(void**)d);
}
void xbt_cfg_host_free(void *d){
xbt_host_t *h=(xbt_host_t*) *(void**)d;
if (h) {
- if (h->name) xbt_free(h->name);
- xbt_free(h);
+ if (h->name) free(h->name);
+ free(h);
}
}
if (!c) return;
xbt_dynar_free(&(c->content));
- xbt_free(c);
+ free(c);
}
/*----[ Registering stuff ]-----------------------------------------------*/
* @arg cfg the config set
* @arg entry a string describing the element to register
*
- * The string may consist in several variable description separated by a space.
+ * The string may consist in several variable descriptions separated by a space.
* Each of them must use the following syntax: \<name\>:\<min nb\>_to_\<max nb\>_\<type\>
* with type being one of 'string','int', 'host' or 'double'.
*/
ERROR3("%s%s%s",
"Invalid config element descriptor: ",entry,
"; Should be <name>:<min nb>_to_<max nb>_<type>");
- xbt_free(entrycpy);
+ free(entrycpy);
xbt_abort();
}
*(tok++)='\0';
min=strtol(tok, &tok, 10);
if (!tok) {
ERROR1("Invalid minimum in config element descriptor %s",entry);
- xbt_free(entrycpy);
+ free(entrycpy);
xbt_abort();
}
ERROR3("%s%s%s",
"Invalid config element descriptor: ",entry,
"; Should be <name>:<min nb>_to_<max nb>_<type>");
- xbt_free(entrycpy);
+ free(entrycpy);
xbt_abort();
}
tok += strlen("_to_");
max=strtol(tok, &tok, 10);
if (!tok) {
ERROR1("Invalid maximum in config element descriptor %s",entry);
- xbt_free(entrycpy);
+ free(entrycpy);
xbt_abort();
}
ERROR3("%s%s%s",
"Invalid config element descriptor: ",entry,
"; Should be <name>:<min nb>_to_<max nb>_<type>");
- xbt_free(entrycpy);
+ free(entrycpy);
xbt_abort();
}
ERROR3("%s%s%s",
"Invalid type in config element descriptor: ",entry,
"; Should be one of 'string', 'int', 'host' or 'double'.");
- xbt_free(entrycpy);
+ free(entrycpy);
xbt_abort();
}
xbt_cfg_register(cfg,entrycpy,type,min,max);
- xbt_free(entrycpy); /* strdup'ed by dict mechanism, but cannot be const */
+ free(entrycpy); /* strdup'ed by dict mechanism, but cannot be const */
return no_error;
}
val=strchr(name,':');
if (!val) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
xbt_assert1(FALSE,
"Malformated option: '%s'; Should be of the form 'name:value'",
name);
break;
case mismatch_error:
ERROR1("No registrated variable corresponding to '%s'.",name);
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
return mismatch_error;
break;
default:
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
return errcode;
}
case xbt_cfgelm_string:
errcode = xbt_cfg_set_string(cfg, name, val);
if (errcode != no_error) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
return errcode;
}
break;
case xbt_cfgelm_int:
i=strtol(val, &val, 0);
if (val==NULL) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
xbt_assert1(FALSE,
"Value of option %s not valid. Should be an integer",
name);
errcode = xbt_cfg_set_int(cfg,name,i);
if (errcode != no_error) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
return errcode;
}
break;
case xbt_cfgelm_double:
d=strtod(val, &val);
if (val==NULL) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
xbt_assert1(FALSE,
"Value of option %s not valid. Should be a double",
name);
errcode = xbt_cfg_set_double(cfg,name,d);
if (errcode != no_error) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
return errcode;
}
break;
str=val;
val=strchr(val,':');
if (!val) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
xbt_assert1(FALSE,
"Value of option %s not valid. Should be an host (machine:port)",
name);
*(val++)='\0';
i=strtol(val, &val, 0);
if (val==NULL) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
xbt_assert1(FALSE,
"Value of option %s not valid. Should be an host (machine:port)",
name);
errcode = xbt_cfg_set_host(cfg,name,str,i);
if (errcode != no_error) {
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
return errcode;
}
break;
default:
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
RAISE1(unknown_error,"Type of config element %s is not valid.",name);
}
}
- xbt_free(optionlist_cpy);
+ free(optionlist_cpy);
return no_error;
}