Commit 8aaf5075 authored by antirez's avatar antirez
Browse files

dict.c: make chaining strategy more clear in dictAddRaw().

parent 7885e126
...@@ -342,7 +342,10 @@ dictEntry *dictAddRaw(dict *d, void *key) ...@@ -342,7 +342,10 @@ dictEntry *dictAddRaw(dict *d, void *key)
if ((index = _dictKeyIndex(d, key)) == -1) if ((index = _dictKeyIndex(d, key)) == -1)
return NULL; return NULL;
/* Allocate the memory and store the new entry */ /* Allocate the memory and store the new entry.
* Insert the element in top, with the assumption that in a database
* system it is more likely that recently added entries are accessed
* more frequently. */
ht = dictIsRehashing(d) ? &d->ht[1] : &d->ht[0]; ht = dictIsRehashing(d) ? &d->ht[1] : &d->ht[0];
entry = zmalloc(sizeof(*entry)); entry = zmalloc(sizeof(*entry));
entry->next = ht->table[index]; entry->next = ht->table[index];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment