Request an exported API pointer. The return value is just a void pointer * that the caller of this function will be required to cast to the right * function pointer, so this is a private contract between modules. * * If the requested API is not available then NULL is returned. Because * modules can be loaded at different times with different order, this * function calls should be put inside
| 7286 | * } |
| 7287 | */ |
| 7288 | void *RM_GetSharedAPI(RedisModuleCtx *ctx, const char *apiname) { |
| 7289 | dictEntry *de = dictFind(server.sharedapi, apiname); |
| 7290 | if (de == NULL) return NULL; |
| 7291 | RedisModuleSharedAPI *sapi = dictGetVal(de); |
| 7292 | if (listSearchKey(sapi->module->usedby,ctx->module) == NULL) { |
| 7293 | listAddNodeTail(sapi->module->usedby,ctx->module); |
| 7294 | listAddNodeTail(ctx->module->using,sapi->module); |
| 7295 | } |
| 7296 | return sapi->func; |
| 7297 | } |
| 7298 | |
| 7299 | /* Remove all the APIs registered by the specified module. Usually you |
| 7300 | * want this when the module is going to be unloaded. This function |
nothing calls this directly
no test coverage detected