| 239 | } |
| 240 | |
| 241 | static void moveToNextTask(redisReader *r) { |
| 242 | redisReadTask *cur, *prv; |
| 243 | while (r->ridx >= 0) { |
| 244 | /* Return a.s.a.p. when the stack is now empty. */ |
| 245 | if (r->ridx == 0) { |
| 246 | r->ridx--; |
| 247 | return; |
| 248 | } |
| 249 | |
| 250 | cur = r->task[r->ridx]; |
| 251 | prv = r->task[r->ridx-1]; |
| 252 | assert(prv->type == REDIS_REPLY_ARRAY || |
| 253 | prv->type == REDIS_REPLY_MAP || |
| 254 | prv->type == REDIS_REPLY_SET || |
| 255 | prv->type == REDIS_REPLY_PUSH); |
| 256 | if (cur->idx == prv->elements-1) { |
| 257 | r->ridx--; |
| 258 | } else { |
| 259 | /* Reset the type because the next item can be anything */ |
| 260 | assert(cur->idx < prv->elements); |
| 261 | cur->type = -1; |
| 262 | cur->elements = -1; |
| 263 | cur->idx++; |
| 264 | return; |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | static int processLineItem(redisReader *r) { |
| 270 | redisReadTask *cur = r->task[r->ridx]; |
no outgoing calls
no test coverage detected