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

Function RM_InfoBeginDictField

src/module.cpp:7128–7143  ·  view source on GitHub ↗

Starts a dict field, similar to the ones in INFO KEYSPACE. Use normal * RedisModule_InfoAddField* functions to add the items to this field, and * terminate with RedisModule_InfoEndDictField. */

Source from the content-addressed store, hash-verified

7126 * RedisModule_InfoAddField* functions to add the items to this field, and
7127 * terminate with RedisModule_InfoEndDictField. */
7128int RM_InfoBeginDictField(RedisModuleInfoCtx *ctx, char *name) {
7129 if (!ctx->in_section)
7130 return REDISMODULE_ERR;
7131 /* Implicitly end dicts, instead of returning an error which is likely un checked. */
7132 if (ctx->in_dict_field)
7133 RM_InfoEndDictField(ctx);
7134 char *tmpmodname, *tmpname;
7135 ctx->info = sdscatfmt(ctx->info,
7136 "%s_%s:",
7137 getSafeInfoString(ctx->module->name, strlen(ctx->module->name), &tmpmodname),
7138 getSafeInfoString(name, strlen(name), &tmpname));
7139 if (tmpmodname != NULL) zfree(tmpmodname);
7140 if (tmpname != NULL) zfree(tmpname);
7141 ctx->in_dict_field = 1;
7142 return REDISMODULE_OK;
7143}
7144
7145/* Ends a dict field, see RedisModule_InfoBeginDictField */
7146int RM_InfoEndDictField(RedisModuleInfoCtx *ctx) {

Callers

nothing calls this directly

Calls 4

RM_InfoEndDictFieldFunction · 0.85
sdscatfmtFunction · 0.85
getSafeInfoStringFunction · 0.85
zfreeFunction · 0.85

Tested by

no test coverage detected