提交 58e1c9c1 编写于 作者: A antirez

added dictFetchValue() to dict.c to make hash table API a bit less verbose in the common cases

上级 d4dd6556
......@@ -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));
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册