mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
dict.c: dictReplaceRaw() -> dictAddOrFind().
What they say about "naming things" in programming?
This commit is contained in:
parent
041ab04419
commit
09a50d34a2
2
src/db.c
2
src/db.c
@ -943,7 +943,7 @@ void setExpire(redisDb *db, robj *key, long long when) {
|
||||
/* Reuse the sds from the main dict in the expire dict */
|
||||
kde = dictFind(db->dict,key->ptr);
|
||||
serverAssertWithInfo(NULL,key,kde != NULL);
|
||||
de = dictReplaceRaw(db->expires,dictGetKey(kde));
|
||||
de = dictAddOrFind(db->expires,dictGetKey(kde));
|
||||
dictSetSignedIntegerVal(de,when);
|
||||
}
|
||||
|
||||
|
@ -395,13 +395,13 @@ int dictReplace(dict *d, void *key, void *val)
|
||||
}
|
||||
|
||||
/* Add or Find:
|
||||
* dictReplaceRaw() is simply a version of dictAddRaw() that always
|
||||
* dictAddOrFind() is simply a version of dictAddRaw() that always
|
||||
* returns the hash entry of the specified key, even if the key already
|
||||
* exists and can't be added (in that case the entry of the already
|
||||
* existing key is returned.)
|
||||
*
|
||||
* See dictAddRaw() for more information. */
|
||||
dictEntry *dictReplaceRaw(dict *d, void *key) {
|
||||
dictEntry *dictAddOrFind(dict *d, void *key) {
|
||||
dictEntry *entry, *existing;
|
||||
entry = dictAddRaw(d,key,&existing);
|
||||
return entry ? entry : existing;
|
||||
|
@ -151,8 +151,8 @@ dict *dictCreate(dictType *type, void *privDataPtr);
|
||||
int dictExpand(dict *d, unsigned long size);
|
||||
int dictAdd(dict *d, void *key, void *val);
|
||||
dictEntry *dictAddRaw(dict *d, void *key, dictEntry **existing);
|
||||
dictEntry *dictAddOrFind(dict *d, void *key);
|
||||
int dictReplace(dict *d, void *key, void *val);
|
||||
dictEntry *dictReplaceRaw(dict *d, void *key);
|
||||
int dictDelete(dict *d, const void *key);
|
||||
dictEntry *dictUnlink(dict *ht, const void *key);
|
||||
void dictFreeUnlinkedEntry(dict *d, dictEntry *he);
|
||||
|
Loading…
Reference in New Issue
Block a user