mirror of
https://github.com/fluencelabs/redis
synced 2025-06-23 22:11:33 +00:00
added an union in the dict.h structure to store 64 bit integers directly into hash table entries.
This commit is contained in:
@ -270,7 +270,7 @@ int dictAdd(dict *d, void *key, void *val)
|
||||
if ((index = _dictKeyIndex(d, key)) == -1)
|
||||
return DICT_ERR;
|
||||
|
||||
/* Allocates the memory and stores key */
|
||||
/* Allocate the memory and store the new entry */
|
||||
ht = dictIsRehashing(d) ? &d->ht[1] : &d->ht[0];
|
||||
entry = zmalloc(sizeof(*entry));
|
||||
entry->next = ht->table[index];
|
||||
@ -297,7 +297,6 @@ int dictReplace(dict *d, void *key, void *val)
|
||||
return 1;
|
||||
/* It already exists, get the entry */
|
||||
entry = dictFind(d, key);
|
||||
/* Free the old value and set the new one */
|
||||
/* Set the new value and free the old one. Note that it is important
|
||||
* to do that in this order, as the value may just be exactly the same
|
||||
* as the previous one. In this context, think to reference counting,
|
||||
|
Reference in New Issue
Block a user