Make moveToNextTask non-recursive
This commit is contained in:
parent
9c4ee606d6
commit
183220bf60
38
hiredis.c
38
hiredis.c
@ -186,26 +186,26 @@ static char *readLine(redisReader *r, int *_len) {
|
|||||||
|
|
||||||
static void moveToNextTask(redisReader *r) {
|
static void moveToNextTask(redisReader *r) {
|
||||||
redisReadTask *cur, *prv;
|
redisReadTask *cur, *prv;
|
||||||
assert(r->ridx >= 0);
|
while (r->ridx >= 0) {
|
||||||
|
/* Return a.s.a.p. when the stack is now empty. */
|
||||||
|
if (r->ridx == 0) {
|
||||||
|
r->ridx--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return a.s.a.p. when the stack is now empty. */
|
cur = &(r->rstack[r->ridx]);
|
||||||
if (r->ridx == 0) {
|
prv = &(r->rstack[r->ridx-1]);
|
||||||
r->ridx--;
|
assert(prv->type == REDIS_REPLY_ARRAY);
|
||||||
return;
|
if (cur->idx == prv->elements-1) {
|
||||||
}
|
r->ridx--;
|
||||||
|
} else {
|
||||||
cur = &(r->rstack[r->ridx]);
|
/* Reset the type because the next item can be anything */
|
||||||
prv = &(r->rstack[r->ridx-1]);
|
assert(cur->idx < prv->elements);
|
||||||
assert(prv->type == REDIS_REPLY_ARRAY);
|
cur->type = -1;
|
||||||
if (cur->idx == prv->elements-1) {
|
cur->elements = -1;
|
||||||
r->ridx--;
|
cur->idx++;
|
||||||
moveToNextTask(r);
|
return;
|
||||||
} else {
|
}
|
||||||
/* Reset the type because the next item can be anything */
|
|
||||||
assert(cur->idx < prv->elements);
|
|
||||||
cur->type = -1;
|
|
||||||
cur->elements = -1;
|
|
||||||
cur->idx++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user