Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a dict parameter to dictelm functions.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 25 Nov 2011 17:45:13 +0000 (18:45 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 1 Dec 2011 10:32:45 +0000 (11:32 +0100)
Unused for now.

src/xbt/dict.c
src/xbt/dict_elm.c
src/xbt/dict_private.h

index 4ec20c9..4bbe272 100644 (file)
@@ -67,7 +67,7 @@ void xbt_dict_free(xbt_dict_t * dict)
       while (current != NULL) {
         previous = current;
         current = current->next;
       while (current != NULL) {
         previous = current;
         current = current->next;
-        xbt_dictelm_free(previous);
+        xbt_dictelm_free(*dict, previous);
         (*dict)->count--;
       }
     }
         (*dict)->count--;
       }
     }
@@ -244,7 +244,7 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
 
   if (current == NULL) {
     /* this key doesn't exist yet */
 
   if (current == NULL) {
     /* this key doesn't exist yet */
-    current = xbt_dictelm_new(key, key_len, hash_code, data, free_ctn);
+    current = xbt_dictelm_new(dict, key, key_len, hash_code, data, free_ctn);
     dict->count++;
     if (previous == NULL) {
       dict->table[hash_code & dict->table_size] = current;
     dict->count++;
     if (previous == NULL) {
       dict->table[hash_code & dict->table_size] = current;
@@ -461,7 +461,7 @@ XBT_INLINE void xbt_dict_remove_ext(xbt_dict_t dict, const char *key,
   if (!dict->table[hash_code & dict->table_size])
     dict->fill--;
 
   if (!dict->table[hash_code & dict->table_size])
     dict->fill--;
 
-  xbt_dictelm_free(current);
+  xbt_dictelm_free(dict, current);
   dict->count--;
 }
 
   dict->count--;
 }
 
@@ -536,7 +536,7 @@ void xbt_dict_reset(xbt_dict_t dict)
     while (current != NULL) {
       previous = current;
       current = current->next;
     while (current != NULL) {
       previous = current;
       current = current->next;
-      xbt_dictelm_free(previous);
+      xbt_dictelm_free(dict, previous);
     }
     dict->table[i] = NULL;
   }
     }
     dict->table[i] = NULL;
   }
index cda2c44..ab3ae5b 100644 (file)
@@ -23,10 +23,9 @@ XBT_LOG_NEW_SUBCATEGORY(xbt_dict_collapse, xbt_dict,
 
 xbt_mallocator_t dict_elm_mallocator = NULL;
 
 
 xbt_mallocator_t dict_elm_mallocator = NULL;
 
-xbt_dictelm_t xbt_dictelm_new(const char *key,
-                              int key_len,
-                              unsigned int hash_code,
-                              void *content, void_f_pvoid_t free_f)
+xbt_dictelm_t xbt_dictelm_new(xbt_dict_t dict, const char *key, int key_len,
+                              unsigned int hash_code, void *content,
+                              void_f_pvoid_t free_f)
 {
   xbt_dictelm_t element = xbt_mallocator_get(dict_elm_mallocator);
 
 {
   xbt_dictelm_t element = xbt_mallocator_get(dict_elm_mallocator);
 
@@ -44,7 +43,7 @@ xbt_dictelm_t xbt_dictelm_new(const char *key,
   return element;
 }
 
   return element;
 }
 
-void xbt_dictelm_free(xbt_dictelm_t element)
+void xbt_dictelm_free(xbt_dict_t dict, xbt_dictelm_t element)
 {
   if (element != NULL) {
     xbt_free(element->key);
 {
   if (element != NULL) {
     xbt_free(element->key);
index c25f8d9..a641b51 100644 (file)
@@ -49,9 +49,9 @@ extern void *dict_elm_mallocator_new_f(void);
 #define dict_elm_mallocator_reset_f ((void_f_pvoid_t)NULL)
 
 /*####[ Function prototypes ]################################################*/
 #define dict_elm_mallocator_reset_f ((void_f_pvoid_t)NULL)
 
 /*####[ Function prototypes ]################################################*/
-xbt_dictelm_t xbt_dictelm_new(const char *key, int key_len,
+xbt_dictelm_t xbt_dictelm_new(xbt_dict_t dict, const char *key, int key_len,
                               unsigned int hash_code, void *content,
                               void_f_pvoid_t free_f);
                               unsigned int hash_code, void *content,
                               void_f_pvoid_t free_f);
-void xbt_dictelm_free(xbt_dictelm_t element);
+void xbt_dictelm_free(xbt_dict_t dict, xbt_dictelm_t element);
 
 #endif                          /* _XBT_DICT_PRIVATE_H_ */
 
 #endif                          /* _XBT_DICT_PRIVATE_H_ */