Browse files

Use const in modules types mem_usage method.

As suggested by @itamarhaber.
  • Loading branch information...
1 parent 3f79b2f commit 636c693f447f4c242a1fff5ad987bc6102b3e243 @antirez committed Jan 12, 2017
Showing with 4 additions and 4 deletions.
  1. +2 −2 src/modules/hellotype.c
  2. +1 −1 src/redismodule.h
  3. +1 −1 src/server.h
@@ -228,8 +228,8 @@ void HelloTypeAofRewrite(RedisModuleIO *aof, RedisModuleString *key, void *value
/* The goal of this function is to return the amount of memory used by
* the HelloType value. */
-size_t HelloTypeMemUsage(void *value) {
- struct HelloTypeObject *hto = value;
+size_t HelloTypeMemUsage(const void *value) {
+ const struct HelloTypeObject *hto = value;
struct HelloTypeNode *node = hto->head;
return sizeof(*hto) + sizeof(*node)*hto->len;
@@ -91,7 +91,7 @@ typedef int (*RedisModuleCmdFunc) (RedisModuleCtx *ctx, RedisModuleString **argv
typedef void *(*RedisModuleTypeLoadFunc)(RedisModuleIO *rdb, int encver);
typedef void (*RedisModuleTypeSaveFunc)(RedisModuleIO *rdb, void *value);
typedef void (*RedisModuleTypeRewriteFunc)(RedisModuleIO *aof, RedisModuleString *key, void *value);
-typedef size_t (*RedisModuleTypeMemUsageFunc)(void *value);
+typedef size_t (*RedisModuleTypeMemUsageFunc)(const void *value);
typedef void (*RedisModuleTypeDigestFunc)(RedisModuleDigest *digest, void *value);
typedef void (*RedisModuleTypeFreeFunc)(void *value);
@@ -483,7 +483,7 @@ typedef void *(*moduleTypeLoadFunc)(struct RedisModuleIO *io, int encver);
typedef void (*moduleTypeSaveFunc)(struct RedisModuleIO *io, void *value);
typedef void (*moduleTypeRewriteFunc)(struct RedisModuleIO *io, struct redisObject *key, void *value);
typedef void (*moduleTypeDigestFunc)(struct RedisModuleDigest *digest, void *value);
-typedef size_t (*moduleTypeMemUsageFunc)(void *value);
+typedef size_t (*moduleTypeMemUsageFunc)(const void *value);
typedef void (*moduleTypeFreeFunc)(void *value);
/* The module type, which is referenced in each value of a given type, defines

0 comments on commit 636c693

Please sign in to comment.