]> git.saurik.com Git - redis.git/blobdiff - src/t_zset.c
Fix used function in ZCARD
[redis.git] / src / t_zset.c
index 35d95ba750229fb8a34247552bcde8fe3cb29a01..3c9ede1c0971ff6e8747ab02834c1abe3f80582f 100644 (file)
@@ -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) {