summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-06-13 09:57:10 +0200
committerantirez <antirez@gmail.com>2016-06-13 09:57:19 +0200
commit5831dd860a5a355d242eb32da2e95aa93451d896 (patch)
tree6e57f999f1be415c62066f7d74407e89591328a5 /src/modules
parenta4bce77e920be0a0140ac81d2cbc79e2ed88eefb (diff)
downloadredis-5831dd860a5a355d242eb32da2e95aa93451d896.tar.gz
Fix example modules to have the right OnLoad() prototype.
Related to #3293.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/hellotype.c2
-rw-r--r--src/modules/helloworld.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/modules/hellotype.c b/src/modules/hellotype.c
index 4ea5c0ce9..a9c2d20fc 100644
--- a/src/modules/hellotype.c
+++ b/src/modules/hellotype.c
@@ -236,7 +236,7 @@ void HelloTypeFree(void *value) {
/* This function must be present on each Redis module. It is used in order to
* register the commands into the Redis server. */
-int RedisModule_OnLoad(RedisModuleCtx *ctx) {
+int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (RedisModule_Init(ctx,"hellotype",1,REDISMODULE_APIVER_1)
== REDISMODULE_ERR) return REDISMODULE_ERR;
diff --git a/src/modules/helloworld.c b/src/modules/helloworld.c
index 8786f4dfa..8d657a52b 100644
--- a/src/modules/helloworld.c
+++ b/src/modules/helloworld.c
@@ -539,10 +539,16 @@ int HelloLeftPad_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
/* This function must be present on each Redis module. It is used in order to
* register the commands into the Redis server. */
-int RedisModule_OnLoad(RedisModuleCtx *ctx) {
+int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (RedisModule_Init(ctx,"helloworld",1,REDISMODULE_APIVER_1)
== REDISMODULE_ERR) return REDISMODULE_ERR;
+ /* Log the list of parameters passing loading the module. */
+ for (int j = 0; j < argc; j++) {
+ const char *s = RedisModule_StringPtrLen(argv[j],NULL);
+ printf("Module loaded with ARGV[%d] = %s\n", j, s);
+ }
+
if (RedisModule_CreateCommand(ctx,"hello.simple",
HelloSimple_RedisCommand,"readonly",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;