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
912b9165
Commit
912b9165
authored
Mar 03, 2010
by
Pieter Noordhuis
Browse files
rank is very unlikely to overflow integer range
parent
709d0a1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
912b9165
...
@@ -456,7 +456,7 @@ typedef struct _redisSortOperation {
...
@@ -456,7 +456,7 @@ typedef struct _redisSortOperation {
typedef struct zskiplistNode {
typedef struct zskiplistNode {
struct zskiplistNode **forward;
struct zskiplistNode **forward;
struct zskiplistNode *backward;
struct zskiplistNode *backward;
unsigned
long
*span;
unsigned
int
*span;
double score;
double score;
robj *obj;
robj *obj;
} zskiplistNode;
} zskiplistNode;
...
@@ -4798,7 +4798,7 @@ static zskiplistNode *zslCreateNode(int level, double score, robj *obj) {
...
@@ -4798,7 +4798,7 @@ static zskiplistNode *zslCreateNode(int level, double score, robj *obj) {
zskiplistNode *zn = zmalloc(sizeof(*zn));
zskiplistNode *zn = zmalloc(sizeof(*zn));
zn->forward = zmalloc(sizeof(zskiplistNode*) * level);
zn->forward = zmalloc(sizeof(zskiplistNode*) * level);
zn->span = zmalloc(sizeof(unsigned
long
) * level);
zn->span = zmalloc(sizeof(unsigned
int
) * level);
zn->score = score;
zn->score = score;
zn->obj = obj;
zn->obj = obj;
return zn;
return zn;
...
@@ -4851,7 +4851,7 @@ static int zslRandomLevel(void) {
...
@@ -4851,7 +4851,7 @@ static int zslRandomLevel(void) {
static void zslInsert(zskiplist *zsl, double score, robj *obj) {
static void zslInsert(zskiplist *zsl, double score, robj *obj) {
zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x;
zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x;
unsigned
long
span[ZSKIPLIST_MAXLEVEL];
unsigned
int
span[ZSKIPLIST_MAXLEVEL];
int i, level;
int i, level;
x = zsl->header;
x = zsl->header;
...
@@ -5434,7 +5434,7 @@ static void zrankCommand(redisClient *c) {
...
@@ -5434,7 +5434,7 @@ static void zrankCommand(redisClient *c) {
double *score = dictGetEntryVal(de);
double *score = dictGetEntryVal(de);
zskiplistNode *x;
zskiplistNode *x;
unsigned
long
rank = 0;
unsigned
int
rank = 0;
int i;
int i;
x = zsl->header;
x = zsl->header;
...
...
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