Fix used function in ZCARD

This commit is contained in:
Pieter Noordhuis 2011-03-09 16:13:39 +01:00
parent a669d5e999
commit cc4c964b33

View File

@ -451,6 +451,7 @@ int zzlCompareElements(unsigned char *eptr, unsigned char *cstr, unsigned int cl
unsigned int zzlLength(robj *zobj) { unsigned int zzlLength(robj *zobj) {
unsigned char *zl = zobj->ptr; unsigned char *zl = zobj->ptr;
redisAssert(zobj->encoding == REDIS_ENCODING_ZIPLIST);
return ziplistLen(zl)/2; return ziplistLen(zl)/2;
} }
@ -1602,7 +1603,7 @@ void zcardCommand(redisClient *c) {
if ((zobj = lookupKeyReadOrReply(c,key,shared.czero)) == NULL || if ((zobj = lookupKeyReadOrReply(c,key,shared.czero)) == NULL ||
checkType(c,zobj,REDIS_ZSET)) return; checkType(c,zobj,REDIS_ZSET)) return;
addReplyLongLong(c,zzlLength(zobj)); addReplyLongLong(c,zsLength(zobj));
} }
void zscoreCommand(redisClient *c) { void zscoreCommand(redisClient *c) {