summaryrefslogtreecommitdiff
path: root/src/modules/helloworld.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-10-13 12:41:48 +0200
committerantirez <antirez@gmail.com>2016-10-13 12:43:18 +0200
commit870274bea8b67fdcc828ed77c783d7146b86af11 (patch)
tree92556da1d3cc10da66a56f9af3c91ca7a8eeb3f7 /src/modules/helloworld.c
parent7dde8bf3ab721b87f1e48b277dcdc39aab4c8b4c (diff)
downloadredis-870274bea8b67fdcc828ed77c783d7146b86af11.tar.gz
Example modules: remove warnings about types and not used args.
Diffstat (limited to 'src/modules/helloworld.c')
-rw-r--r--src/modules/helloworld.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules/helloworld.c b/src/modules/helloworld.c
index 4d6f8782d..4e30af2a0 100644
--- a/src/modules/helloworld.c
+++ b/src/modules/helloworld.c
@@ -46,6 +46,8 @@
* fetch the currently selected DB, the other in order to send the client
* an integer reply as response. */
int HelloSimple_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
+ REDISMODULE_NOT_USED(argv);
+ REDISMODULE_NOT_USED(argc);
RedisModule_ReplyWithLongLong(ctx,RedisModule_GetSelectedDb(ctx));
return REDISMODULE_OK;
}
@@ -237,6 +239,8 @@ int HelloRandArray_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, i
* comments the function implementation). */
int HelloRepl1_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
+ REDISMODULE_NOT_USED(argv);
+ REDISMODULE_NOT_USED(argc);
RedisModuleCallReply *reply;
RedisModule_AutoMemory(ctx);
@@ -519,7 +523,7 @@ int HelloLeftPad_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
/* If the string is already larger than the target len, just return
* the string itself. */
- if (strlen >= padlen)
+ if (strlen >= (size_t)padlen)
return RedisModule_ReplyWithString(ctx,argv[1]);
/* Padding must be a single character in this simple implementation. */
@@ -530,7 +534,7 @@ int HelloLeftPad_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
/* Here we use our pool allocator, for our throw-away allocation. */
padlen -= strlen;
char *buf = RedisModule_PoolAlloc(ctx,padlen+strlen);
- for (size_t j = 0; j < padlen; j++) buf[j] = *ch;
+ for (long long j = 0; j < padlen; j++) buf[j] = *ch;
memcpy(buf+padlen,str,strlen);
RedisModule_ReplyWithStringBuffer(ctx,buf,padlen+strlen);