diff --git a/example/Makefile b/example/Makefile index dbd529b..88f4700 100644 --- a/example/Makefile +++ b/example/Makefile @@ -20,15 +20,9 @@ else endif CFLAGS = -I$(RM_INCLUDE_DIR) -Wall -g -fPIC -lc -lm -Og -std=gnu99 CC=gcc -.SUFFIXES: .c .so .xo .o all: module.so -#c.xo: -#$(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@ - -#mdma.xo: ./index.h - module.so: module.o $(LD) -o $@ module.o $(SHOBJ_LDFLAGS) $(LIBS) -L$(RMUTIL_LIBDIR) -lrmutil -lc diff --git a/example/module.c b/example/module.c index 3ee5efd..829544d 100644 --- a/example/module.c +++ b/example/module.c @@ -32,7 +32,7 @@ int ParseCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { RedisModule_ReplyWithLongLong(ctx, x * y); return REDISMODULE_ERR; } - + // something is fishy... RedisModule_ReplyWithError(ctx, "Invalid arguments"); diff --git a/rmutil/strings.c b/rmutil/strings.c index dca50d9..6adf3bc 100644 --- a/rmutil/strings.c +++ b/rmutil/strings.c @@ -27,7 +27,7 @@ int RMUtil_StringEquals(RedisModuleString *s1, RedisModuleString *s2) { c1 = RedisModule_StringPtrLen(s1, &l1); c2 = RedisModule_StringPtrLen(s2, &l2); - return strcmp(c1, c2) == 0; + return strncmp(c1, c2, MAX(l1, l2)) == 0; } void RMUtil_StringToLower(RedisModuleString *s) { diff --git a/rmutil/util.c b/rmutil/util.c index f5656e9..b2706fa 100644 --- a/rmutil/util.c +++ b/rmutil/util.c @@ -18,7 +18,7 @@ int RMUtil_ArgExists(const char *arg, RedisModuleString **argv, int argc, int of for (; offset < argc; offset++) { size_t l; const char *carg = RedisModule_StringPtrLen(argv[offset], &l); - if (carg != NULL && strncasecmp(carg, arg, l) == 0) { + if (carg != NULL && strcasecmp(carg, arg) == 0) { return offset; } }