summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-03-27 10:10:22 +0100
committerantirez <antirez@gmail.com>2015-03-27 10:10:39 +0100
commitadcb4701308f3d543d9b2bc66a9a691ec571006b (patch)
tree9003ac723c5a3a3a2ec050bd34317c95890b6372
parent2b5cf6bf78159f8d4bbd48b7159444fd3a4de914 (diff)
downloadredis-adcb4701308f3d543d9b2bc66a9a691ec571006b.tar.gz
dict.c: add casting to avoid compilation warning.
rehashidx is always positive in the two code paths, since the only negative value it could have is -1 when there is no rehashing in progress, and the condition is explicitly checked.
-rw-r--r--src/dict.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dict.c b/src/dict.c
index 43add1927..99a697365 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -710,7 +710,7 @@ unsigned int dictGetRandomKeys(dict *d, dictEntry **des, unsigned int count) {
/* Invariant of the dict.c rehashing: up to the indexes already
* visited in ht[0] during the rehashing, there are no populated
* buckets, so we can skip ht[0] for indexes between 0 and idx-1. */
- if (tables == 2 && j == 0 && i < d->rehashidx) {
+ if (tables == 2 && j == 0 && i < (unsigned int) d->rehashidx) {
/* Moreover, if we are currently out of range in the second
* table, there will be no elements in both tables up to
* the current rehashing index, so we jump if possible.
@@ -788,7 +788,7 @@ unsigned int dictGetSomeKeys(dict *d, dictEntry **des, unsigned int count) {
/* Invariant of the dict.c rehashing: up to the indexes already
* visited in ht[0] during the rehashing, there are no populated
* buckets, so we can skip ht[0] for indexes between 0 and idx-1. */
- if (tables == 2 && j == 0 && i < d->rehashidx) {
+ if (tables == 2 && j == 0 && i < (unsigned int) d->rehashidx) {
/* Moreover, if we are currently out of range in the second
* table, there will be no elements in both tables up to
* the current rehashing index, so we jump if possible.