From: Frederic Suter Date: Sat, 4 Nov 2017 21:19:23 +0000 (+0100) Subject: there are still C users ... X-Git-Tag: v3.18~286^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d4bd9b37042660070b9b0086cd9d6d80793806a7 there are still C users ... + cosmetics --- diff --git a/include/xbt/config.h b/include/xbt/config.h index 0b8440851d..4ad8e1f809 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -73,6 +73,7 @@ XBT_PUBLIC(void) xbt_cfg_set_parse(const char *options); XBT_PUBLIC(void) xbt_cfg_set_int (const char *name, int val); XBT_PUBLIC(void) xbt_cfg_set_double (const char *name, double val); XBT_PUBLIC(void) xbt_cfg_set_boolean (const char *name, const char *val); +XBT_PUBLIC(void) xbt_cfg_set_string(const char* name, const char* val); XBT_PUBLIC(void) xbt_cfg_set_as_string(const char *name, const char *val); /* diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index c3d0c4cc5d..d457e57a4e 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -239,6 +239,5 @@ public: } } XBT_PUBLIC(std::string) xbt_cfg_get_string(const char* name); -XBT_PUBLIC(void) xbt_cfg_set_string(const char* name, std::string val); #endif diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index ad5d6518a3..ee0542ce8e 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -530,7 +530,7 @@ static void surf_config_models_setup() if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) && xbt_cfg_is_default_value("host/model")) { host_model_name = "compound"; - xbt_cfg_set_string("host/model", host_model_name); + xbt_cfg_set_string("host/model", host_model_name.c_str()); } XBT_DEBUG("host model: %s", host_model_name.c_str()); diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index 0d2265d4f2..cb26929e8c 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -147,8 +147,7 @@ public: /* Callback */ xbt_cfg_cb_t old_callback = nullptr; - ConfigurationElement(const char* key, const char* desc) - : key(key ? key : ""), desc(desc ? desc : "") {} + ConfigurationElement(const char* key, const char* desc) : key(key ? key : ""), desc(desc ? desc : "") {} ConfigurationElement(const char* key, const char* desc, xbt_cfg_cb_t cb) : key(key ? key : ""), desc(desc ? desc : ""), old_callback(cb) {} @@ -261,7 +260,7 @@ class Config { private: // name -> ConfigElement: std::map options; - // alias -> xbt_dict_elm_t from options: + // alias -> ConfigElement from options: std::map aliases; bool warn_for_aliases = true; @@ -657,13 +656,13 @@ void xbt_cfg_set_double(const char *key, double value) * @param value the value to be added * */ -void xbt_cfg_set_string(const char* key, std::string value) +void xbt_cfg_set_string(const char* key, const char* value) { try { (*simgrid_config)[key].setValue(value); return; } - TRANSLATE_EXCEPTIONS("Could not set variable %s to string %s", key, value.c_str()); + TRANSLATE_EXCEPTIONS("Could not set variable %s to string %s", key, value); } /** @brief Set or add a boolean value to \a name within \a cfg