Skip to content

Commit

Permalink
Merge pull request redis#132 from nwmcsween/constify
Browse files Browse the repository at this point in the history
constify: constify some variables / functions
  • Loading branch information
pietern committed Jul 11, 2013
2 parents 37a840d + ba6c3c1 commit 049346a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions async.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand All @@ -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;
}

Expand Down

0 comments on commit 049346a

Please sign in to comment.