#include "xbt/peer.h"
#include "xbt/config.h" /* prototypes of this module */
-#include "surf/surf.h" /* COORD_HOST_LEVEL and COORD_ASR_LEVEL */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
TRY {
type = xbt_cfg_get_type(cfg, name);
- } CATCH(e) {
+ }
+ CATCH(e) {
if (e.category == not_found_error) {
xbt_ex_free(e);
THROWF(not_found_error, 0,
}
*(val++) = '\0';
- if (!strcmp(name,"coordinates")){
- if(!strcmp(val,"yes") && !COORD_HOST_LEVEL){
- XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);
- COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_dynar_free_voidp);
- COORD_ASR_LEVEL = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
- free(optionlist_cpy);
- return;
- }
- if(strcmp(val,"yes"))
- xbt_die("Setting CMD prop coordinates must be \"yes\"");
- }
-
- if (strcmp(name,"contexts/factory"))
+ if (strncmp(name, "contexts/", strlen("contexts/")))
XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);
TRY {
variable = xbt_dict_get((xbt_dict_t) cfg, name);
}
CATCH(e) {
- /* put it back on what won't get freed, ie within "options" and out of "optionlist_cpy" */
- name = (char *) (optionlist_cpy - name + options);
- free(optionlist_cpy);
if (e.category == not_found_error) {
xbt_ex_free(e);
+ name = xbt_strdup(name);
+ free(optionlist_cpy);
THROWF(not_found_error, 0,
"No registered variable corresponding to '%s'.", name);
}
+ free(optionlist_cpy);
RETHROW;
}
name);
}
}
- CATCH(e) {
+ CATCH_ANONYMOUS {
free(optionlist_cpy);
RETHROW;
}
TRY {
variable = xbt_dict_get((xbt_dict_t) cfg, name);
- } CATCH(e) {
+ }
+ CATCH(e) {
if (e.category != not_found_error)
RETHROW;
TRY {
variable = xbt_dict_get((xbt_dict_t) cfg, name);
- } CATCH(e) {
+ }
+ CATCH(e) {
if (e.category == not_found_error) {
xbt_ex_free(e);
THROWF(not_found_error, 0,
TRY {
xbt_cfg_set_parse(myset, "color:blue");
- } CATCH(e) {
+ }
+ CATCH(e) {
if (e.category != not_found_error)
xbt_test_exception(e);
xbt_ex_free(e);