-xbt_dictelm_t xbt_dictelm_new(const char *key,
- int key_len,
- void *content,
- void_f_pvoid_t free_f,
- xbt_dictelm_t next) {
- xbt_dictelm_t element = xbt_mallocator_get(dict_elm_mallocator);
-
+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;
+
+ if (dict->homogeneous) {
+ xbt_assert(!free_f,
+ "Cannot set an individual free function in homogeneous dicts.");
+ element = xbt_mallocator_get(dict_elm_mallocator);
+ } else {
+ xbt_het_dictelm_t het_element = xbt_mallocator_get(dict_het_elm_mallocator);
+ het_element->free_f = free_f;
+ element = &het_element->element;
+ }