Add pointer to parent task in read tasks

This commit is contained in:
Pieter Noordhuis 2010-11-24 15:21:34 +01:00
parent 3d702d0bf1
commit d4058be7b0
2 changed files with 3 additions and 1 deletions

View File

@ -313,6 +313,7 @@ static int processMultiBulkItem(redisReader *r) {
r->rstack[r->ridx].type = -1;
r->rstack[r->ridx].elements = -1;
r->rstack[r->ridx].parent = obj;
r->rstack[r->ridx].parentTask = cur;
r->rstack[r->ridx].idx = 0;
r->rstack[r->ridx].privdata = r->privdata;
} else {
@ -471,7 +472,7 @@ int redisReplyReaderGetReply(void *reader, void **reply) {
if (r->ridx == -1) {
r->rstack[0].type = -1;
r->rstack[0].elements = -1;
r->rstack[0].parent = NULL;
r->rstack[0].parent = r->rstack[0].parentTask = NULL;
r->rstack[0].idx = -1;
r->rstack[0].privdata = r->privdata;
r->ridx = 0;

View File

@ -88,6 +88,7 @@ typedef struct redisReadTask {
int elements; /* number of elements in multibulk container */
void *parent; /* optional pointer to parent object */
int idx; /* index in parent (array) object */
struct redisReadTask *parentTask; /* pointer to parent task */
void *privdata; /* user-settable arbitrary field */
} redisReadTask;