diff --git a/fx.collections/hashtable.c b/fx.collections/hashtable.c index 8ce5798..54c556e 100644 --- a/fx.collections/hashtable.c +++ b/fx.collections/hashtable.c @@ -114,6 +114,15 @@ static fx_status allocate_index_for_key( break; } + const struct fx_hashtable_item_p *item = fx_object_get_private( + table[index].i_item, + FX_TYPE_HASHTABLE_ITEM); + int cmp = fx_value_compare(&item->i_key, v); + if (cmp == 0) { + ok = true; + break; + } + index = (index + (i * i)) % table_size; i++; } @@ -277,7 +286,6 @@ static fx_status hashtable_put( fx_value_copy(&item_p->i_key, key); fx_value_copy(&item_p->i_value, value); - assert(hashtable->t_items[index].i_item == NULL); hashtable->t_items[index].i_item = item; hashtable->t_count++; return FX_SUCCESS;