diff --git a/dict.c b/dict.c index 08bffbff..d5010708 100644 --- a/dict.c +++ b/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)); diff --git a/dict.h b/dict.h index ba8f8695..30ace4db 100644 --- a/dict.h +++ b/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);