summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2017-11-30 11:34:37 +0800
committerantirez <antirez@gmail.com>2017-12-05 15:38:03 +0100
commit7c6ddbc37d572600b6364348c9506dc190493e2e (patch)
treecc45aac85fe5d956d79e15e100792abaea5252e1
parentd1176b582c8f482e46821527114c5c1476bc66d4 (diff)
downloadredis-7c6ddbc37d572600b6364348c9506dc190493e2e.tar.gz
dict: fix the int problem for defrag
-rw-r--r--src/defrag.c2
-rw-r--r--src/dict.c4
-rw-r--r--src/dict.h4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/defrag.c b/src/defrag.c
index 4a1dcefe4..3f0e6627c 100644
--- a/src/defrag.c
+++ b/src/defrag.c
@@ -289,7 +289,7 @@ int defragKey(redisDb *db, dictEntry *de) {
/* Dirty code:
* I can't search in db->expires for that key after i already released
* the pointer it holds it won't be able to do the string compare */
- unsigned int hash = dictGetHash(db->dict, de->key);
+ uint64_t hash = dictGetHash(db->dict, de->key);
replaceSateliteDictKeyPtrAndOrDefragDictEntry(db->expires, keysds, newsds, hash, &defragged);
}
diff --git a/src/dict.c b/src/dict.c
index 49bbc92b2..97e636805 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -995,7 +995,7 @@ void dictDisableResize(void) {
dict_can_resize = 0;
}
-unsigned int dictGetHash(dict *d, const void *key) {
+uint64_t dictGetHash(dict *d, const void *key) {
return dictHashKey(d, key);
}
@@ -1004,7 +1004,7 @@ unsigned int dictGetHash(dict *d, const void *key) {
* the hash value should be provided using dictGetHash.
* no string / key comparison is performed.
* return value is the reference to the dictEntry if found, or NULL if not found. */
-dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, unsigned int hash) {
+dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t hash) {
dictEntry *he, **heref;
unsigned long idx, table;
diff --git a/src/dict.h b/src/dict.h
index bf316a00f..62018cc44 100644
--- a/src/dict.h
+++ b/src/dict.h
@@ -178,8 +178,8 @@ int dictRehashMilliseconds(dict *d, int ms);
void dictSetHashFunctionSeed(uint8_t *seed);
uint8_t *dictGetHashFunctionSeed(void);
unsigned long dictScan(dict *d, unsigned long v, dictScanFunction *fn, dictScanBucketFunction *bucketfn, void *privdata);
-unsigned int dictGetHash(dict *d, const void *key);
-dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, unsigned int hash);
+uint64_t dictGetHash(dict *d, const void *key);
+dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t hash);
/* Hash table types */
extern dictType dictTypeHeapStringCopyKey;