Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
[simgrid.git] / include / xbt / dict.h
index 2ee6f60..e36d2b9 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <stdint.h>             /* uintptr_t */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @addtogroup XBT_dict
  *  @brief The dictionary data structure (comparable to hash tables)
@@ -30,10 +30,10 @@ SG_BEGIN_DECL()
  char buff[512];
 
  sprintf(buff,"some very precious data");
- xbt_dict_set(mydict,"my data", strdup(buff), NULL);
+ xbt_dict_set(mydict,"my data", strdup(buff));
 
  sprintf(buff,"another good stuff");
- xbt_dict_set(mydict,"my data", strdup(buff), NULL); // previous data gets erased (and freed) by second add
+ xbt_dict_set(mydict,"my data", strdup(buff)); // previous data gets erased (and freed) by second add
 @endverbatim
  */
 
@@ -69,7 +69,7 @@ XBT_PUBLIC unsigned int xbt_dict_size(xbt_dict_t dict);
  *  @{
  */
 
-XBT_PUBLIC void xbt_dict_set(xbt_dict_t dict, const char* key, void* data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC void xbt_dict_set(xbt_dict_t dict, const char* key, void* data);
 XBT_PUBLIC void* xbt_dict_get(xbt_dict_t dict, const char* key);
 XBT_PUBLIC void* xbt_dict_get_or_null(xbt_dict_t dict, const char* key);
 XBT_PUBLIC char* xbt_dict_get_key(xbt_dict_t dict, const void* data);
@@ -79,7 +79,6 @@ XBT_PUBLIC xbt_dictelm_t xbt_dict_get_elm_or_null(xbt_dict_t dict, const char* k
 XBT_PUBLIC void xbt_dict_remove(xbt_dict_t dict, const char* key);
 XBT_PUBLIC void xbt_dict_reset(xbt_dict_t dict);
 XBT_PUBLIC int xbt_dict_length(xbt_dict_t dict);
-XBT_PUBLIC void xbt_dict_dump(xbt_dict_t dict, void (*output)(void*));
 XBT_PUBLIC int xbt_dict_is_empty(xbt_dict_t dict);
 
 /** @} */
@@ -90,7 +89,7 @@ XBT_PUBLIC int xbt_dict_is_empty(xbt_dict_t dict);
  *
  *  @{
  */
-XBT_PUBLIC void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data);
 XBT_PUBLIC void* xbt_dict_get_ext(xbt_dict_t dict, const char* key, int key_len);
 XBT_PUBLIC void* xbt_dict_get_or_null_ext(xbt_dict_t dict, const char* key, int key_len);
 XBT_PUBLIC void xbt_dict_remove_ext(xbt_dict_t dict, const char* key, int key_len);
@@ -159,13 +158,12 @@ xbt_dict_foreach(head, cursor, key, data) {
 }
 @endcode
  */
-#  define xbt_dict_foreach(dict,cursor,key,data)                       \
-    for (cursor=NULL, xbt_dict_cursor_first((dict),&(cursor)) ;        \
-         xbt_dict_cursor_get_or_free(&(cursor),(char**)&(key),(void**)(&data));\
-         xbt_dict_cursor_step(cursor) )
+#define xbt_dict_foreach(dict, cursor, key, data)                                                                      \
+  for ((cursor) = NULL, xbt_dict_cursor_first((dict), &(cursor));                                                      \
+       xbt_dict_cursor_get_or_free(&(cursor), (char**)&(key), (void**)&(data)); xbt_dict_cursor_step(cursor))
 
 /** @} */
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* XBT_DICT_H */