From cc4c964b33ac108c9541e31eb2e2420addf9a82e Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Wed, 9 Mar 2011 16:13:39 +0100 Subject: [PATCH] Fix used function in ZCARD --- src/t_zset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t_zset.c b/src/t_zset.c index 35d95ba75..3c9ede1c0 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -451,6 +451,7 @@ int zzlCompareElements(unsigned char *eptr, unsigned char *cstr, unsigned int cl unsigned int zzlLength(robj *zobj) { unsigned char *zl = zobj->ptr; + redisAssert(zobj->encoding == REDIS_ENCODING_ZIPLIST); return ziplistLen(zl)/2; } @@ -1602,7 +1603,7 @@ void zcardCommand(redisClient *c) { if ((zobj = lookupKeyReadOrReply(c,key,shared.czero)) == NULL || checkType(c,zobj,REDIS_ZSET)) return; - addReplyLongLong(c,zzlLength(zobj)); + addReplyLongLong(c,zsLength(zobj)); } void zscoreCommand(redisClient *c) {