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

Function RM_InfoBeginDictField

app/redis-6.2.6/src/module.c:6936–6951  ·  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

6934 * RedisModule_InfoAddField* functions to add the items to this field, and
6935 * terminate with RedisModule_InfoEndDictField. */
6936int RM_InfoBeginDictField(RedisModuleInfoCtx *ctx, char *name) {
6937 if (!ctx->in_section)
6938 return REDISMODULE_ERR;
6939 /* Implicitly end dicts, instead of returning an error which is likely un checked. */
6940 if (ctx->in_dict_field)
6941 RM_InfoEndDictField(ctx);
6942 char *tmpmodname, *tmpname;
6943 ctx->info = sdscatfmt(ctx->info,
6944 "%s_%s:",
6945 getSafeInfoString(ctx->module->name, strlen(ctx->module->name), &tmpmodname),
6946 getSafeInfoString(name, strlen(name), &tmpname));
6947 if (tmpmodname != NULL) zfree(tmpmodname);
6948 if (tmpname != NULL) zfree(tmpname);
6949 ctx->in_dict_field = 1;
6950 return REDISMODULE_OK;
6951}
6952
6953/* Ends a dict field, see RedisModule_InfoBeginDictField */
6954int RM_InfoEndDictField(RedisModuleInfoCtx *ctx) {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected