Search, in the list of exported data types of all the modules registered, * a type with the same name as the one given. Returns the moduleType * structure pointer if such a module is found, or NULL otherwise. */
| 4394 | * a type with the same name as the one given. Returns the moduleType |
| 4395 | * structure pointer if such a module is found, or NULL otherwise. */ |
| 4396 | moduleType *moduleTypeLookupModuleByName(const char *name) { |
| 4397 | dictIterator *di = dictGetIterator(modules); |
| 4398 | dictEntry *de; |
| 4399 | |
| 4400 | while ((de = dictNext(di)) != NULL) { |
| 4401 | struct RedisModule *module = (RedisModule*)dictGetVal(de); |
| 4402 | listIter li; |
| 4403 | listNode *ln; |
| 4404 | |
| 4405 | listRewind(module->types,&li); |
| 4406 | while((ln = listNext(&li))) { |
| 4407 | moduleType *mt = (moduleType*)ln->value; |
| 4408 | if (memcmp(name,mt->name,sizeof(mt->name)) == 0) { |
| 4409 | dictReleaseIterator(di); |
| 4410 | return mt; |
| 4411 | } |
| 4412 | } |
| 4413 | } |
| 4414 | dictReleaseIterator(di); |
| 4415 | return NULL; |
| 4416 | } |
| 4417 | |
| 4418 | /* Lookup a module by ID, with caching. This function is used during RDB |
| 4419 | * loading. Modules exporting data types should never be able to unload, so |
no test coverage detected