Commit ba6c3c15 authored by Nathan McSween's avatar Nathan McSween
Browse files

constify: constify some variables / functions

parent 3c46b13a
...@@ -62,7 +62,8 @@ void __redisAppendCommand(redisContext *c, char *cmd, size_t len); ...@@ -62,7 +62,8 @@ void __redisAppendCommand(redisContext *c, char *cmd, size_t len);
/* Functions managing dictionary of callbacks for pub/sub. */ /* Functions managing dictionary of callbacks for pub/sub. */
static unsigned int callbackHash(const void *key) { static unsigned int callbackHash(const void *key) {
return dictGenHashFunction((unsigned char*)key,sdslen((char*)key)); return dictGenHashFunction((const unsigned char*)key
, sdslen((const char*)key));
} }
static void *callbackValDup(void *privdata, const void *src) { static void *callbackValDup(void *privdata, const void *src) {
...@@ -73,7 +74,7 @@ static void *callbackValDup(void *privdata, const void *src) { ...@@ -73,7 +74,7 @@ static void *callbackValDup(void *privdata, const void *src) {
} }
static int callbackKeyCompare(void *privdata, const void *key1, const void *key2) { static int callbackKeyCompare(void *privdata, const void *key1, const void *key2) {
int l1, l2; const int l1, l2;
((void) privdata); ((void) privdata);
l1 = sdslen((sds)key1); l1 = sdslen((sds)key1);
......
...@@ -665,7 +665,7 @@ int redisReaderGetReply(redisReader *r, void **reply) { ...@@ -665,7 +665,7 @@ int redisReaderGetReply(redisReader *r, void **reply) {
} }
/* Calculate the number of bytes needed to represent an integer as string. */ /* Calculate the number of bytes needed to represent an integer as string. */
static int intlen(int i) { static const int intlen(int i) {
int len = 0; int len = 0;
if (i < 0) { if (i < 0) {
len++; len++;
...@@ -679,7 +679,7 @@ static int intlen(int i) { ...@@ -679,7 +679,7 @@ static int intlen(int i) {
} }
/* Helper that calculates the bulk length given a certain string length. */ /* Helper that calculates the bulk length given a certain string length. */
static size_t bulklen(size_t len) { static const size_t bulklen(size_t len) {
return 1+intlen(len)+2+len+2; return 1+intlen(len)+2+len+2;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment