summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2019-08-18 10:01:57 +0300
committerOran Agra <oran@redislabs.com>2019-08-18 10:01:57 +0300
commit61853ad8dea0a3ddd8da77a257405452a114bd65 (patch)
treeee3b0ce759be99e2896ebb9affe51b7a0952c6c0 /src
parent1d6e5dc4dcacb1af4698d16e695494f62129071e (diff)
downloadredis-61853ad8dea0a3ddd8da77a257405452a114bd65.tar.gz
Module INFO, support default section for simple modules
Diffstat (limited to 'src')
-rw-r--r--src/module.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/module.c b/src/module.c
index c48b2f045..046b9bc86 100644
--- a/src/module.c
+++ b/src/module.c
@@ -4709,9 +4709,12 @@ int RM_InfoEndDictField(RedisModuleInfoCtx *ctx);
/* Used to start a new section, before adding any fields. the section name will
* be prefixed by "<modulename>_" and must only include A-Z,a-z,0-9.
+ * NULL or empty string indicates the default section (only <modulename>) is used.
* When return value is REDISMODULE_ERR, the section should and will be skipped. */
int RM_InfoAddSection(RedisModuleInfoCtx *ctx, char *name) {
- sds full_name = sdscatprintf(sdsdup(ctx->module->name), "_%s", name);
+ sds full_name = sdsdup(ctx->module->name);
+ if (name != NULL && strlen(name) > 0)
+ full_name = sdscatprintf(full_name, "_%s", name);
/* Implicitly end dicts, instead of returning an error which is likely un checked. */
if (ctx->in_dict_field)