modify compare function to check if the encoding is equal before comparing

This commit is contained in:
Pieter Noordhuis 2010-05-29 16:22:24 +02:00
parent a5456b2cb6
commit d593c48869
1 changed files with 5 additions and 5 deletions

View File

@ -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;