Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't pass the free_f parameter to MSG_*_set_property_value()
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 4 Dec 2016 18:26:03 +0000 (19:26 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 4 Dec 2016 18:26:56 +0000 (19:26 +0100)
ChangeLog
examples/msg/platform-properties/platform-properties.c
examples/simdag/properties/sd_properties.c
include/simgrid/msg.h
src/msg/msg_gos.cpp
src/msg/msg_host.cpp
src/msg/msg_io.cpp
src/surf/PropertyHolder.cpp
teshsuite/msg/storage_client_server/storage_client_server.c

index 2abf16e..a3aeb1c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,10 @@ SimGrid (3.14) UNRELEASED; urgency=low
    - MSG_mailbox_get_task_ext() -> MSG_task_receive_ext()
    - MSG_mailbox_get_task_ext_bounded -> MSG_task_receive_ext_bounded
    - MSG_host_(get/set)_params -> MSG_vm_(get/set)_params
+ * Don't pass the free_f parameter to property related functions:
+   - MSG_host_set_property_value()
+   - MSG_as_router_set_property_value()
+   - MSG_storage_set_property_value()
  * VM properties. Since msg_vm_t are msg_host_t, just use
    MSG_host_get_property_value() and friends
 
index 375b03b..06db78b 100644 (file)
@@ -32,7 +32,7 @@ static void test_host(const char*hostname)
   XBT_INFO("   Property: %s old value: %s", exist, value);
 
   XBT_INFO("== Trying to modify a host property");
-  MSG_host_set_property_value(thehost, exist, xbt_strdup("250"), xbt_free_f);
+  MSG_host_set_property_value(thehost, exist, xbt_strdup("250"));
 
   /* Test if we have changed the value */
   value = MSG_host_get_property_value(thehost, exist);
@@ -41,7 +41,7 @@ static void test_host(const char*hostname)
   XBT_INFO("   Property: %s old value: %s", exist, value);
 
   /* Restore the value for the next test */
-  MSG_host_set_property_value(thehost, exist, xbt_strdup("180"), xbt_free_f);
+  MSG_host_set_property_value(thehost, exist, xbt_strdup("180"));
 }
 
 static int alice(int argc, char *argv[]) { /* Dump what we have on the current host */
index 040e55b..8271459 100644 (file)
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
   xbt_dict_t props = sg_host_get_properties(h1);
 
   /* Trying to set a new property */
-  xbt_dict_set(props, "NewProp", strdup("newValue"), xbt_free_f);
+  xbt_dict_set(props, "NewProp", strdup("newValue"), NULL);
 
   /* Print the properties of 'host1' */
   xbt_dict_foreach(props, cursor, key, data) {
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
     XBT_INFO("\tProperty: %s is undefined", exist);
   else {
     XBT_INFO("\tProperty: %s old value: %s", exist, value);
-    xbt_dict_set(props, exist, strdup("250"), xbt_free_f);
+    xbt_dict_set(props, exist, strdup("250"), NULL);
   }
 
   /* Test if we have changed the value */
index eab901e..ec7c1cd 100644 (file)
@@ -215,7 +215,7 @@ XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(msg_storage_t storage);
 XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(msg_storage_t storage);
 XBT_PUBLIC(msg_storage_t) MSG_storage_get_by_name(const char *name);
 XBT_PUBLIC(xbt_dict_t) MSG_storage_get_properties(msg_storage_t storage);
-XBT_PUBLIC(void) MSG_storage_set_property_value(msg_storage_t storage, const char *name, char *value,void_f_pvoid_t free_ctn);
+XBT_PUBLIC(void) MSG_storage_set_property_value(msg_storage_t storage, const char* name, char* value);
 XBT_PUBLIC(const char *)MSG_storage_get_property_value(msg_storage_t storage, const char *name);
 XBT_PUBLIC(xbt_dynar_t) MSG_storages_as_dynar();
 XBT_PUBLIC(msg_error_t) MSG_storage_set_data(msg_storage_t host, void *data);
@@ -227,7 +227,7 @@ XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage);
 /************************** AS Router handling ************************************/
 XBT_PUBLIC(const char *) MSG_as_router_get_property_value(const char* asr, const char *name);
 XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr);
-XBT_PUBLIC(void) MSG_as_router_set_property_value(const char* asr, const char *name, char *value,void_f_pvoid_t free_ctn);
+XBT_PUBLIC(void) MSG_as_router_set_property_value(const char* asr, const char* name, char* value);
 
 /************************** Host handling ***********************************/
 XBT_PUBLIC(msg_host_t) MSG_host_by_name(const char *name);
@@ -266,10 +266,7 @@ XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
 XBT_PUBLIC(const char *) MSG_host_get_property_value(msg_host_t host,
                                                      const char *name);
-XBT_PUBLIC(void) MSG_host_set_property_value(msg_host_t host,
-                                             const char *name, char *value,
-                                             void_f_pvoid_t free_ctn);
-
+XBT_PUBLIC(void) MSG_host_set_property_value(msg_host_t host, const char* name, char* value);
 
 XBT_PUBLIC(void) MSG_create_environment(const char *file);
 
index 74d22e2..ba4b478 100644 (file)
@@ -949,8 +949,8 @@ xbt_dict_t MSG_as_router_get_properties(const char* asr)
  * \param asr the name of a router or AS
  * \param name a property name
  * \param value what to change the property to
- * \param free_ctn the freeing function to use to kill the value on need
  */
-void MSG_as_router_set_property_value(const char* asr, const char *name, char *value,void_f_pvoid_t free_ctn) {
-  xbt_dict_set(MSG_as_router_get_properties(asr), name, value,free_ctn);
+void MSG_as_router_set_property_value(const char* asr, const char* name, char* value)
+{
+  xbt_dict_set(MSG_as_router_get_properties(asr), name, value, nullptr);
 }
index 6ae7ac5..b676e16 100644 (file)
@@ -198,10 +198,10 @@ xbt_dict_t MSG_host_get_properties(msg_host_t host)
  * \param host a host
  * \param name a property name
  * \param value what to change the property to
- * \param free_ctn the freeing function to use to kill the value on need
  */
-void MSG_host_set_property_value(msg_host_t host, const char *name, char *value,void_f_pvoid_t free_ctn) {
-  xbt_dict_set(MSG_host_get_properties(host), name, value,free_ctn);
+void MSG_host_set_property_value(msg_host_t host, const char* name, char* value)
+{
+  xbt_dict_set(MSG_host_get_properties(host), name, value, nullptr);
 }
 
 /** @ingroup m_host_management
index a27f879..d7548f7 100644 (file)
@@ -486,10 +486,10 @@ xbt_dict_t MSG_storage_get_properties(msg_storage_t storage)
  * \param storage a storage
  * \param name a property name
  * \param value what to change the property to
- * \param free_ctn the freeing function to use to kill the value on need
  */
-void MSG_storage_set_property_value(msg_storage_t storage, const char *name, char *value,void_f_pvoid_t free_ctn) {
-  xbt_dict_set(MSG_storage_get_properties(storage), name, value,free_ctn);
+void MSG_storage_set_property_value(msg_storage_t storage, const char* name, char* value)
+{
+  xbt_dict_set(MSG_storage_get_properties(storage), name, value, nullptr);
 }
 
 /** \ingroup m_storage_management
index 53f09d5..48f372f 100644 (file)
@@ -25,14 +25,14 @@ const char *PropertyHolder::getProperty(const char*key) {
 /** @brief Change the value of a given key in the property set */
 void PropertyHolder::setProperty(const char*key, const char*value) {
   if (!properties_)
-    properties_ = xbt_dict_new();
-  xbt_dict_set(properties_, key, xbt_strdup(value), &xbt_free_f);
+    properties_ = xbt_dict_new_homogeneous(xbt_free_f);
+  xbt_dict_set(properties_, key, xbt_strdup(value), nullptr);
 }
 
 /** @brief Return the whole set of properties. Don't mess with it, dude! */
 xbt_dict_t PropertyHolder::getProperties() {
   if (!properties_)
-    properties_ = xbt_dict_new();
+    properties_ = xbt_dict_new_homogeneous(xbt_free_f);
   return properties_;
 }
 
index dcccb93..7c7bea7 100644 (file)
@@ -103,7 +103,7 @@ static void dump_platform_storages(void){
   msg_storage_t storage;
   xbt_dynar_foreach(storages, cursor, storage){
     XBT_INFO("Storage %s is attached to %s", MSG_storage_get_name(storage), MSG_storage_get_host(storage));
-    MSG_storage_set_property_value(storage, "other usage", xbt_strdup("gpfs"), xbt_free_f);
+    MSG_storage_set_property_value(storage, "other usage", xbt_strdup("gpfs"));
   }
   xbt_dynar_free(&storages);
 }