Implements RM_LoadString() and RM_LoadStringBuffer() */
| 4843 | |
| 4844 | /* Implements RM_LoadString() and RM_LoadStringBuffer() */ |
| 4845 | void *moduleLoadString(RedisModuleIO *io, int plain, size_t *lenptr) { |
| 4846 | void *s = nullptr; |
| 4847 | if (io->error) return NULL; |
| 4848 | if (io->ver == 2) { |
| 4849 | uint64_t opcode = rdbLoadLen(io->prio,NULL); |
| 4850 | if (opcode != RDB_MODULE_OPCODE_STRING) goto loaderr; |
| 4851 | } |
| 4852 | s = rdbGenericLoadStringObject(io->prio, |
| 4853 | plain ? RDB_LOAD_PLAIN : RDB_LOAD_NONE, lenptr); |
| 4854 | if (s == NULL) goto loaderr; |
| 4855 | return s; |
| 4856 | |
| 4857 | loaderr: |
| 4858 | moduleRDBLoadError(io); |
| 4859 | return NULL; |
| 4860 | } |
| 4861 | |
| 4862 | /* In the context of the rdb_load method of a module data type, loads a string |
| 4863 | * from the RDB file, that was previously saved with RedisModule_SaveString() |
no test coverage detected