Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8fe586d3
Commit
8fe586d3
authored
Dec 05, 2017
by
zhaozhao.zz
Committed by
antirez
Dec 05, 2017
Browse files
set: fix the int problem for qsort
parent
219e29af
Changes
1
Show whitespace changes
Inline
Side-by-side
src/t_set.c
View file @
8fe586d3
...
...
@@ -774,15 +774,21 @@ void srandmemberCommand(client *c) {
}
int
qsortCompareSetsByCardinality
(
const
void
*
s1
,
const
void
*
s2
)
{
return
setTypeSize
(
*
(
robj
**
)
s1
)
-
setTypeSize
(
*
(
robj
**
)
s2
);
if
(
setTypeSize
(
*
(
robj
**
)
s1
)
>
setTypeSize
(
*
(
robj
**
)
s2
))
return
1
;
if
(
setTypeSize
(
*
(
robj
**
)
s1
)
<
setTypeSize
(
*
(
robj
**
)
s2
))
return
-
1
;
return
0
;
}
/* This is used by SDIFF and in this case we can receive NULL that should
* be handled as empty sets. */
int
qsortCompareSetsByRevCardinality
(
const
void
*
s1
,
const
void
*
s2
)
{
robj
*
o1
=
*
(
robj
**
)
s1
,
*
o2
=
*
(
robj
**
)
s2
;
unsigned
long
first
=
o1
?
setTypeSize
(
o1
)
:
0
;
unsigned
long
second
=
o2
?
setTypeSize
(
o2
)
:
0
;
return
(
o2
?
setTypeSize
(
o2
)
:
0
)
-
(
o1
?
setTypeSize
(
o1
)
:
0
);
if
(
first
<
second
)
return
1
;
if
(
first
>
second
)
return
-
1
;
return
0
;
}
void
sinterGenericCommand
(
client
*
c
,
robj
**
setkeys
,
...
...
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