*/
XBT_INLINE unsigned int xbt_dict_size(xbt_dict_t dict)
{
- return dict->count;
+ return (dict ? (unsigned int) dict->count : (unsigned int) 0);
}
/**
{
fputs(s, stdout);
}
-
+/**
+ * \brief test if the dict is empty or not
+ */
+XBT_INLINE int xbt_dict_is_empty(xbt_dict_t dict)
+{
+ return (xbt_dict_size(dict) == 0);
+}
/**
* \brief Outputs the content of the structure (debugging purpose)
}
static void debuged_addi(xbt_dict_t head, uintptr_t key, uintptr_t data) {
+ uintptr_t stored_data = 0;
xbt_test_log2("Add %zu under %zu", data, key);
xbt_dicti_set(head, key, data);
xbt_dict_dump(head, (void (*)(void *)) &printf);
fflush(stdout);
}
- uintptr_t stored_data = xbt_dicti_get(head, key);
+ stored_data = xbt_dicti_get(head, key);
xbt_test_assert3(stored_data==data,
"Retrieved data (%zu) is not what I just stored (%zu) under key %zu",stored_data,data,key);
}