MCPcopy Create free account
hub / github.com/F-Stack/f-stack / moduleLoadString

Function moduleLoadString

app/redis-6.2.6/src/module.c:4739–4753  ·  view source on GitHub ↗

Implements RM_LoadString() and RM_LoadStringBuffer() */

Source from the content-addressed store, hash-verified

4737
4738/* Implements RM_LoadString() and RM_LoadStringBuffer() */
4739void *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
4750loaderr:
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()

Callers 2

RM_LoadStringFunction · 0.85
RM_LoadStringBufferFunction · 0.85

Calls 3

rdbLoadLenFunction · 0.85
moduleRDBLoadErrorFunction · 0.85

Tested by

no test coverage detected