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

Function RM_SaveStringBuffer

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

Like RedisModule_SaveString() but takes a raw C pointer and length * as input. */

Source from the content-addressed store, hash-verified

4720/* Like RedisModule_SaveString() but takes a raw C pointer and length
4721 * as input. */
4722void RM_SaveStringBuffer(RedisModuleIO *io, const char *str, size_t len) {
4723 if (io->error) return;
4724 /* Save opcode. */
4725 ssize_t retval = rdbSaveLen(io->rio, RDB_MODULE_OPCODE_STRING);
4726 if (retval == -1) goto saveerr;
4727 io->bytes += retval;
4728 /* Save value. */
4729 retval = rdbSaveRawString(io->rio, (unsigned char*)str,len);
4730 if (retval == -1) goto saveerr;
4731 io->bytes += retval;
4732 return;
4733
4734saveerr:
4735 io->error = 1;
4736}
4737
4738/* Implements RM_LoadString() and RM_LoadStringBuffer() */
4739void *moduleLoadString(RedisModuleIO *io, int plain, size_t *lenptr) {

Callers 1

RM_SaveLongDoubleFunction · 0.85

Calls 2

rdbSaveLenFunction · 0.85
rdbSaveRawStringFunction · 0.85

Tested by

no test coverage detected