Commit 183220bf authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

Make moveToNextTask non-recursive

parent 9c4ee606
...@@ -186,26 +186,26 @@ static char *readLine(redisReader *r, int *_len) { ...@@ -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. */
/* Return a.s.a.p. when the stack is now empty. */ if (r->ridx == 0) {
if (r->ridx == 0) { r->ridx--;
r->ridx--; return;
return; }
}
cur = &(r->rstack[r->ridx]); cur = &(r->rstack[r->ridx]);
prv = &(r->rstack[r->ridx-1]); prv = &(r->rstack[r->ridx-1]);
assert(prv->type == REDIS_REPLY_ARRAY); assert(prv->type == REDIS_REPLY_ARRAY);
if (cur->idx == prv->elements-1) { if (cur->idx == prv->elements-1) {
r->ridx--; r->ridx--;
moveToNextTask(r); } else {
} else { /* Reset the type because the next item can be anything */
/* Reset the type because the next item can be anything */ assert(cur->idx < prv->elements);
assert(cur->idx < prv->elements); cur->type = -1;
cur->type = -1; cur->elements = -1;
cur->elements = -1; cur->idx++;
cur->idx++; return;
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment