Remove all the APIs registered by the specified module. Usually you * want this when the module is going to be unloaded. This function * assumes that's caller responsibility to make sure the APIs are not * used by other modules. * * The number of unregistered APIs is returned. */
| 7495 | * |
| 7496 | * The number of unregistered APIs is returned. */ |
| 7497 | int moduleUnregisterSharedAPI(RedisModule *module) { |
| 7498 | int count = 0; |
| 7499 | dictIterator *di = dictGetSafeIterator(g_pserver->sharedapi); |
| 7500 | dictEntry *de; |
| 7501 | while ((de = dictNext(di)) != NULL) { |
| 7502 | const char *apiname = (const char*)dictGetKey(de); |
| 7503 | RedisModuleSharedAPI *sapi = (RedisModuleSharedAPI*)dictGetVal(de); |
| 7504 | if (sapi->module == module) { |
| 7505 | dictDelete(g_pserver->sharedapi,apiname); |
| 7506 | zfree(sapi); |
| 7507 | count++; |
| 7508 | } |
| 7509 | } |
| 7510 | dictReleaseIterator(di); |
| 7511 | return count; |
| 7512 | } |
| 7513 | |
| 7514 | /* Remove the specified module as an user of APIs of ever other module. |
| 7515 | * This is usually called when a module is unloaded. |
no test coverage detected