mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 09:11:20 +00:00
dict.c: introduce dictUnlink().
Notes by @antirez: This patch was picked from a larger commit by Oran and adapted to change the API a bit. The basic idea is to avoid double lookups when there is to use the value of the deleted entry. BEFORE: entry = dictFind( ... ); /* 1st lookup. */ /* Do somethjing with the entry. */ dictDelete(...); /* 2nd lookup. */ AFTER: entry = dictUnlink( ... ); /* 1st lookup. */ /* Do somethjing with the entry. */ dictFreeUnlinkedEntry(entry); /* No lookups!. */
This commit is contained in:
@ -3085,7 +3085,8 @@ int moduleUnload(sds name) {
|
||||
|
||||
/* Remove from list of modules. */
|
||||
serverLog(LL_NOTICE,"Module %s unloaded",module->name);
|
||||
dictDeleteNoFree(modules,module->name);
|
||||
dictDelete(modules,module->name);
|
||||
module->name = NULL; /* The name was already freed by dictDelete(). */
|
||||
moduleFreeModuleStructure(module);
|
||||
|
||||
return REDISMODULE_OK;
|
||||
|
Reference in New Issue
Block a user