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
e22f3e40
Commit
e22f3e40
authored
Jun 22, 2016
by
Yossi Gottlieb
Browse files
Cleanup: remove zset reset function from RM_ZsetRangeStop().
parent
a8e20345
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
e22f3e40
...
...
@@ -163,7 +163,8 @@ void RM_CloseKey(RedisModuleKey *key);
void
autoMemoryCollect
(
RedisModuleCtx
*
ctx
);
robj
**
moduleCreateArgvFromUserFormat
(
const
char
*
cmdname
,
const
char
*
fmt
,
int
*
argcp
,
int
*
flags
,
va_list
ap
);
void
moduleReplicateMultiIfNeeded
(
RedisModuleCtx
*
ctx
);
void
RM_ZsetRangeStop
(
RedisModuleKey
*
key
);
void
RM_ZsetRangeStop
(
RedisModuleKey
*
kp
);
static
void
zsetKeyReset
(
RedisModuleKey
*
key
);
/* --------------------------------------------------------------------------
* Heap allocation raw functions
...
...
@@ -1047,8 +1048,7 @@ void *RM_OpenKey(RedisModuleCtx *ctx, robj *keyname, int mode) {
kp
->
value
=
value
;
kp
->
iter
=
NULL
;
kp
->
mode
=
mode
;
kp
->
ztype
=
REDISMODULE_ZSET_RANGE_NONE
;
RM_ZsetRangeStop
(
kp
);
zsetKeyReset
(
kp
);
autoMemoryAdd
(
ctx
,
REDISMODULE_AM_KEY
,
kp
);
return
(
void
*
)
kp
;
}
...
...
@@ -1434,17 +1434,23 @@ int RM_ZsetScore(RedisModuleKey *key, RedisModuleString *ele, double *score) {
* Key API for Sorted Set iterator
* -------------------------------------------------------------------------- */
static
void
zsetKeyReset
(
RedisModuleKey
*
key
)
{
key
->
ztype
=
REDISMODULE_ZSET_RANGE_NONE
;
key
->
zcurrent
=
NULL
;
key
->
zer
=
1
;
}
/* Stop a sorted set iteration. */
void
RM_ZsetRangeStop
(
RedisModuleKey
*
key
)
{
/* Free resources if needed. */
if
(
key
->
ztype
==
REDISMODULE_ZSET_RANGE_LEX
)
if
(
key
->
ztype
==
REDISMODULE_ZSET_RANGE_LEX
)
{
zslFreeLexRange
(
&
key
->
zlrs
);
}
/* Setup sensible values so that misused iteration API calls when an
* iterator is not active will result into something more sensible
* than crashing. */
key
->
ztype
=
REDISMODULE_ZSET_RANGE_NONE
;
key
->
zcurrent
=
NULL
;
key
->
zer
=
1
;
zsetKeyReset
(
key
);
}
/* Return the "End of range" flag value to signal the end of the iteration. */
...
...
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