From: Pieter Noordhuis Date: Sat, 29 May 2010 14:22:24 +0000 (+0200) Subject: modify compare function to check if the encoding is equal before comparing X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/d593c48869e1c815fd4b270a1820e71165dafba5 modify compare function to check if the encoding is equal before comparing --- diff --git a/ziplist.c b/ziplist.c index 50b92514..08253f37 100644 --- a/ziplist.c +++ b/ziplist.c @@ -461,12 +461,12 @@ unsigned int ziplistCompare(unsigned char *p, unsigned char *s, unsigned int sle return 0; } } else { + /* Try to compare encoded values */ if (zipTryEncoding(s,&sval,&sencoding)) { - /* Do integer compare */ - val = zipLoadInteger(p+entry.headersize,entry.encoding); - return val == sval; - } else { - /* Ziplist entry is integer encoded, but given entry is not. */ + if (entry.encoding == sencoding) { + val = zipLoadInteger(p+entry.headersize,entry.encoding); + return val == sval; + } } } return 0;