提交 3a706ba7 编写于 作者: A antirez

Use long for rehash and iterator index in dict.h.

This allows to support datasets with more than 2 billion of keys
(possible in very large memory instances, this bug was actually
reported).

Closes issue #1814.
上级 97fdcd87
...@@ -77,7 +77,7 @@ typedef struct dict { ...@@ -77,7 +77,7 @@ typedef struct dict {
dictType *type; dictType *type;
void *privdata; void *privdata;
dictht ht[2]; dictht ht[2];
int rehashidx; /* rehashing not in progress if rehashidx == -1 */ long rehashidx; /* rehashing not in progress if rehashidx == -1 */
int iterators; /* number of iterators currently running */ int iterators; /* number of iterators currently running */
} dict; } dict;
...@@ -87,9 +87,11 @@ typedef struct dict { ...@@ -87,9 +87,11 @@ typedef struct dict {
* should be called while iterating. */ * should be called while iterating. */
typedef struct dictIterator { typedef struct dictIterator {
dict *d; dict *d;
int table, index, safe; long index;
int table, safe;
dictEntry *entry, *nextEntry; dictEntry *entry, *nextEntry;
long long fingerprint; /* unsafe iterator fingerprint for misuse detection */ /* unsafe iterator fingerprint for misuse detection. */
long long fingerprint;
} dictIterator; } dictIterator;
typedef void (dictScanFunction)(void *privdata, const dictEntry *de); typedef void (dictScanFunction)(void *privdata, const dictEntry *de);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册