MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / RM_SaveStringBuffer

Function RM_SaveStringBuffer

src/module.cpp:4828–4842  ·  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

4826/* Like RedisModule_SaveString() but takes a raw C pointer and length
4827 * as input. */
4828void RM_SaveStringBuffer(RedisModuleIO *io, const char *str, size_t len) {
4829 if (io->error) return;
4830 /* Save opcode. */
4831 ssize_t retval = rdbSaveLen(io->prio, RDB_MODULE_OPCODE_STRING);
4832 if (retval == -1) goto saveerr;
4833 io->bytes += retval;
4834 /* Save value. */
4835 retval = rdbSaveRawString(io->prio, (unsigned char*)str,len);
4836 if (retval == -1) goto saveerr;
4837 io->bytes += retval;
4838 return;
4839
4840saveerr:
4841 io->error = 1;
4842}
4843
4844/* Implements RM_LoadString() and RM_LoadStringBuffer() */
4845void *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