Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove useless internal functions.
[simgrid.git] / src / xbt / dict.c
index 5bf48fa..b0a5031 100644 (file)
@@ -23,8 +23,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict, xbt,
 
 static xbt_mallocator_t dict_mallocator = NULL;
 static void *dict_mallocator_new_f(void);
-static void dict_mallocator_free_f(void *dict);
-static void dict_mallocator_reset_f(void *dict);
+#define dict_mallocator_free_f xbt_free_f
+#define dict_mallocator_reset_f ((void_f_pvoid_t)NULL)
 
 
 /*####[ Code ]###############################################################*/
@@ -32,7 +32,7 @@ static void dict_mallocator_reset_f(void *dict);
 /**
  * \brief Constructor
  * \return pointer to the destination
- * \see xbt_dict_new_ext(), xbt_dict_free()
+ * \see xbt_dict_free()
  *
  * Creates and initialize a new dictionary with a default hashtable size.
  */
@@ -658,7 +658,7 @@ void xbt_dict_dump_output_string(void *s)
  */
 XBT_INLINE int xbt_dict_is_empty(xbt_dict_t dict)
 {
-  return (xbt_dict_size(dict) == 0);
+  return !dict || (xbt_dict_length(dict) == 0);
 }
 
 /**
@@ -684,7 +684,7 @@ void xbt_dict_dump(xbt_dict_t dict, void_f_pvoid_t output)
         while (element != NULL) {
           printf(" %s -> '", element->key);
           if (output != NULL) {
-            (*output) (element->content);
+            output(element->content);
           }
           printf("'\n");
           element = element->next;
@@ -816,18 +816,6 @@ static void *dict_mallocator_new_f(void)
   return xbt_new(s_xbt_dict_t, 1);
 }
 
-static void dict_mallocator_free_f(void *dict)
-{
-  xbt_free(dict);
-}
-
-static void dict_mallocator_reset_f(void *dict)
-{
-  /* nothing to do because all fields are
-   * initialized in xbt_dict_new
-   */
-}
-
 #ifdef SIMGRID_TEST
 #include "xbt.h"
 #include "xbt/ex.h"
@@ -941,7 +929,8 @@ static void search_not_found(xbt_dict_t head, const char *data)
     data = xbt_dict_get(head, data);
     THROWF(unknown_error, 0,
            "Found something which shouldn't be there (%s)", data);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
     xbt_ex_free(e);
@@ -974,7 +963,8 @@ static void count(xbt_dict_t dict, int length)
 static void count_check_get_key(xbt_dict_t dict, int length)
 {
   xbt_dict_cursor_t cursor;
-  char *key, *key2;
+  char *key;
+  _XBT_GNUC_UNUSED char *key2;
   void *data;
   int effective = 0;
 
@@ -1014,7 +1004,8 @@ XBT_TEST_UNIT("basic", test_dict_basic, "Basic usage: change, retrieve, traverse
   traverse(head);
   TRY {
     debuged_remove(head, "12346");
-  } CATCH(e) {
+  }
+  CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
     xbt_ex_free(e);