- uintptr_t key, uintptr_t data) {
-
- unsigned int hash_code = xbt_dict_hash_ext((void*)&key, sizeof(uintptr_t));
-
- xbt_dictelm_t current, previous = NULL;
- xbt_assert(dict);
-
- DEBUG5("ADD %zu->%zu; hash = %d, size = %d, & = %d", key, data, hash_code,
- dict->table_size, hash_code & dict->table_size);
- current = dict->table[hash_code & dict->table_size];
- while (current != NULL &&
- (hash_code != current->hash_code || sizeof(uintptr_t) != current->key_len
- || (((uintptr_t)key) != ((uintptr_t)current->key)) )) {
- current = current->next;
- }
-
- if (current == NULL) {
- /* this key doesn't exist yet */
- current = xbt_dictielm_new(key, hash_code, data);
- dict->count++;
- if (previous == NULL) {
- dict->table[hash_code & dict->table_size] = current;
- dict->fill++;
- if ((dict->fill * 100) / (dict->table_size + 1) > MAX_FILL_PERCENT)
- xbt_dict_rehash(dict);
- } else {
- previous->next = current;
- }
- } else {
-
- /* there is already an element with the same key: overwrite it */
- if (current->content != NULL && current->free_f != NULL) {
- current->free_f(current->content);
- }
- current->content = (void*)data;
- current->free_f = NULL;
- }
+ uintptr_t key, uintptr_t data)
+{
+ xbt_dict_set_ext(dict, (void *)&key, sizeof key, (void*)data, NULL);