Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
there are still C users ...
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Sat, 4 Nov 2017 21:19:23 +0000 (22:19 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Sat, 4 Nov 2017 21:19:23 +0000 (22:19 +0100)
+ cosmetics

include/xbt/config.h
include/xbt/config.hpp
src/surf/sg_platf.cpp
src/xbt/config.cpp

index 0b84408..4ad8e1f 100644 (file)
@@ -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);
 
 /*
index c3d0c4c..d457e57 100644 (file)
@@ -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
index ad5d651..ee0542c 100644 (file)
@@ -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());
index 0d2265d..cb26929 100644 (file)
@@ -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<std::string, simgrid::config::ConfigurationElement*> options;
-  // alias -> xbt_dict_elm_t from options:
+  // alias -> ConfigElement from options:
   std::map<std::string, simgrid::config::ConfigurationElement*> 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<std::string>(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