Implements RM_LoadString() and RM_LoadStringBuffer() */
| 4737 | |
| 4738 | /* Implements RM_LoadString() and RM_LoadStringBuffer() */ |
| 4739 | void *moduleLoadString(RedisModuleIO *io, int plain, size_t *lenptr) { |
| 4740 | if (io->error) return NULL; |
| 4741 | if (io->ver == 2) { |
| 4742 | uint64_t opcode = rdbLoadLen(io->rio,NULL); |
| 4743 | if (opcode != RDB_MODULE_OPCODE_STRING) goto loaderr; |
| 4744 | } |
| 4745 | void *s = rdbGenericLoadStringObject(io->rio, |
| 4746 | plain ? RDB_LOAD_PLAIN : RDB_LOAD_NONE, lenptr); |
| 4747 | if (s == NULL) goto loaderr; |
| 4748 | return s; |
| 4749 | |
| 4750 | loaderr: |
| 4751 | moduleRDBLoadError(io); |
| 4752 | return NULL; |
| 4753 | } |
| 4754 | |
| 4755 | /* In the context of the rdb_load method of a module data type, loads a string |
| 4756 | * from the RDB file, that was previously saved with RedisModule_SaveString() |
no test coverage detected