Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b37099a1
Commit
b37099a1
authored
Nov 30, 2017
by
zhaozhao.zz
Committed by
antirez
Dec 05, 2017
Browse files
dict: fix the int problem
parent
8fe586d3
Changes
1
Show whitespace changes
Inline
Side-by-side
src/dict.c
View file @
b37099a1
...
...
@@ -66,7 +66,7 @@ static unsigned int dict_force_resize_ratio = 5;
static
int
_dictExpandIfNeeded
(
dict
*
ht
);
static
unsigned
long
_dictNextPower
(
unsigned
long
size
);
static
int
_dictKeyIndex
(
dict
*
ht
,
const
void
*
key
,
u
nsigned
in
t
hash
,
dictEntry
**
existing
);
static
long
_dictKeyIndex
(
dict
*
ht
,
const
void
*
key
,
u
int64_
t
hash
,
dictEntry
**
existing
);
static
int
_dictInit
(
dict
*
ht
,
dictType
*
type
,
void
*
privDataPtr
);
/* -------------------------- hash functions -------------------------------- */
...
...
@@ -202,7 +202,7 @@ int dictRehash(dict *d, int n) {
de
=
d
->
ht
[
0
].
table
[
d
->
rehashidx
];
/* Move all the keys in this bucket from the old to the new hash HT */
while
(
de
)
{
u
nsigned
in
t
h
;
u
int64_
t
h
;
nextde
=
de
->
next
;
/* Get the index in the new hash table */
...
...
@@ -291,7 +291,7 @@ int dictAdd(dict *d, void *key, void *val)
*/
dictEntry
*
dictAddRaw
(
dict
*
d
,
void
*
key
,
dictEntry
**
existing
)
{
int
index
;
long
index
;
dictEntry
*
entry
;
dictht
*
ht
;
...
...
@@ -362,7 +362,7 @@ dictEntry *dictAddOrFind(dict *d, void *key) {
* dictDelete() and dictUnlink(), please check the top comment
* of those functions. */
static
dictEntry
*
dictGenericDelete
(
dict
*
d
,
const
void
*
key
,
int
nofree
)
{
u
nsigned
in
t
h
,
idx
;
u
int64_
t
h
,
idx
;
dictEntry
*
he
,
*
prevHe
;
int
table
;
...
...
@@ -476,7 +476,7 @@ void dictRelease(dict *d)
dictEntry
*
dictFind
(
dict
*
d
,
const
void
*
key
)
{
dictEntry
*
he
;
u
nsigned
in
t
h
,
idx
,
table
;
u
int64_
t
h
,
idx
,
table
;
if
(
d
->
ht
[
0
].
used
+
d
->
ht
[
1
].
used
==
0
)
return
NULL
;
/* dict is empty */
if
(
dictIsRehashing
(
d
))
_dictRehashStep
(
d
);
...
...
@@ -610,7 +610,7 @@ void dictReleaseIterator(dictIterator *iter)
dictEntry
*
dictGetRandomKey
(
dict
*
d
)
{
dictEntry
*
he
,
*
orighe
;
unsigned
int
h
;
unsigned
long
h
;
int
listlen
,
listele
;
if
(
dictSize
(
d
)
==
0
)
return
NULL
;
...
...
@@ -955,9 +955,9 @@ static unsigned long _dictNextPower(unsigned long size)
*
* Note that if we are in the process of rehashing the hash table, the
* index is always returned in the context of the second (new) hash table. */
static
int
_dictKeyIndex
(
dict
*
d
,
const
void
*
key
,
u
nsigned
in
t
hash
,
dictEntry
**
existing
)
static
long
_dictKeyIndex
(
dict
*
d
,
const
void
*
key
,
u
int64_
t
hash
,
dictEntry
**
existing
)
{
unsigned
int
idx
,
table
;
unsigned
long
idx
,
table
;
dictEntry
*
he
;
if
(
existing
)
*
existing
=
NULL
;
...
...
@@ -1006,7 +1006,7 @@ unsigned int dictGetHash(dict *d, const void *key) {
* 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
*
he
,
**
heref
;
unsigned
int
idx
,
table
;
unsigned
long
idx
,
table
;
if
(
d
->
ht
[
0
].
used
+
d
->
ht
[
1
].
used
==
0
)
return
NULL
;
/* dict is empty */
for
(
table
=
0
;
table
<=
1
;
table
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment