mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 08:30:51 +00:00
added dictFetchValue() to dict.c to make hash table API a bit less verbose in the common cases
This commit is contained in:
parent
d4dd6556c3
commit
58e1c9c143
7
dict.c
7
dict.c
@ -423,6 +423,13 @@ dictEntry *dictFind(dict *d, const void *key)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *dictFetchValue(dict *d, const void *key) {
|
||||
dictEntry *he;
|
||||
|
||||
he = dictFind(d,key);
|
||||
return he ? dictGetEntryVal(he) : NULL;
|
||||
}
|
||||
|
||||
dictIterator *dictGetIterator(dict *d)
|
||||
{
|
||||
dictIterator *iter = _dictAlloc(sizeof(*iter));
|
||||
|
1
dict.h
1
dict.h
@ -129,6 +129,7 @@ int dictDelete(dict *d, const void *key);
|
||||
int dictDeleteNoFree(dict *d, const void *key);
|
||||
void dictRelease(dict *d);
|
||||
dictEntry * dictFind(dict *d, const void *key);
|
||||
void *dictFetchValue(dict *d, const void *key);
|
||||
int dictResize(dict *d);
|
||||
dictIterator *dictGetIterator(dict *d);
|
||||
dictEntry *dictNext(dictIterator *iter);
|
||||
|
Loading…
x
Reference in New Issue
Block a user