summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2013-07-10 23:13:36 -0700
committerPieter Noordhuis <pcnoordhuis@gmail.com>2013-07-10 23:13:36 -0700
commit049346aa3399f98306656921350ca4f04e473e6b (patch)
treede82bb610b3924e811f35261f8d243032cee4fb6
parent37a840dc2c0899e032e0fb05a0813e137a68f032 (diff)
parentba6c3c152cf900151495af65af74547556e82309 (diff)
Merge pull request #132 from nwmcsween/constify
constify: constify some variables / functions
-rw-r--r--async.c5
-rw-r--r--hiredis.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/async.c b/async.c
index 83d88ec..9d7cad1 100644
--- a/async.c
+++ b/async.c
@@ -62,7 +62,8 @@ void __redisAppendCommand(redisContext *c, char *cmd, size_t len);
/* Functions managing dictionary of callbacks for pub/sub. */
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) {
@@ -73,7 +74,7 @@ static void *callbackValDup(void *privdata, const void *src) {
}
static int callbackKeyCompare(void *privdata, const void *key1, const void *key2) {
- int l1, l2;
+ const int l1, l2;
((void) privdata);
l1 = sdslen((sds)key1);
diff --git a/hiredis.c b/hiredis.c
index 80599db..65f84d0 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -665,7 +665,7 @@ int redisReaderGetReply(redisReader *r, void **reply) {
}
/* 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;
if (i < 0) {
len++;
@@ -679,7 +679,7 @@ static int intlen(int i) {
}
/* 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;
}