Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
58e1c9c1
You need to sign in or sign up before continuing.
Commit
58e1c9c1
authored
Apr 16, 2010
by
antirez
Browse files
added dictFetchValue() to dict.c to make hash table API a bit less verbose in the common cases
parent
d4dd6556
Changes
2
Show whitespace changes
Inline
Side-by-side
dict.c
View file @
58e1c9c1
...
...
@@ -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
));
...
...
dict.h
View file @
58e1c9c1
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment