From dc845730a9afaadf20a6a892a458c219c7350dff Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 31 May 2010 23:35:51 +0200 Subject: [PATCH] use list wrapper functions in computing the dataset digest --- redis.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/redis.c b/redis.c index 07a53748..61941d40 100644 --- a/redis.c +++ b/redis.c @@ -10923,16 +10923,14 @@ static void computeDatasetDigest(unsigned char *final) { if (o->type == REDIS_STRING) { mixObjectDigest(digest,o); } else if (o->type == REDIS_LIST) { - list *list = o->ptr; - listNode *ln; - listIter li; - - listRewind(list,&li); - while((ln = listNext(&li))) { - robj *eleobj = listNodeValue(ln); - + lIterator *li = lInitIterator(o,0,REDIS_TAIL); + lEntry entry; + while(lNext(li,&entry)) { + robj *eleobj = lGet(&entry); mixObjectDigest(digest,eleobj); + decrRefCount(eleobj); } + lReleaseIterator(li); } else if (o->type == REDIS_SET) { dict *set = o->ptr; dictIterator *di = dictGetIterator(set); -- 2.45.2