Apply the new dictUnlink() where possible.

Optimizations suggested and originally implemented by @oranagra.
Re-applied by @antirez using the modified API.
This commit is contained in:
antirez
2016-09-14 15:10:53 +02:00
parent afcbcc0e58
commit a636aeac07
3 changed files with 9 additions and 8 deletions

View File

@ -478,8 +478,9 @@ dictEntry *dictUnlink(dict *ht, const void *key) {
}
/* You need to call this function to really free the entry after a call
* to dictUnlink(). */
* to dictUnlink(). It's safe to call this function with 'he' = NULL. */
void dictFreeUnlinkedEntry(dict *d, dictEntry *he) {
if (he == NULL) return;
dictFreeKey(d, he);
dictFreeVal(d, he);
zfree(he);