summaryrefslogtreecommitdiff
path: root/src/ziplist.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2012-05-04 17:26:24 -0700
committerPieter Noordhuis <pcnoordhuis@gmail.com>2012-05-04 17:26:24 -0700
commit0ef889274f104dd1e69021deec1d73ae2a1090a2 (patch)
tree03ff71e94a6fc274f5c1eb1adf656f40b538d925 /src/ziplist.c
parent0cf10e8e867274397f2b7201e51b00996263a143 (diff)
downloadredis-0ef889274f104dd1e69021deec1d73ae2a1090a2.tar.gz
Compare integers in ziplist regardless of encoding
Because of the introduction of new integer encoding types for ziplists in the 2.6 tree, the same integer value may have a different encoding in different versions of the ziplist implementation. This means that the encoding can NOT be used as a fast path in comparing integers.
Diffstat (limited to 'src/ziplist.c')
-rw-r--r--src/ziplist.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ziplist.c b/src/ziplist.c
index e3741f81e..31e61633e 100644
--- a/src/ziplist.c
+++ b/src/ziplist.c
@@ -773,12 +773,11 @@ unsigned int ziplistCompare(unsigned char *p, unsigned char *sstr, unsigned int
return 0;
}
} else {
- /* Try to compare encoded values */
+ /* Try to compare encoded values. Don't compare encoding because
+ * different implementations may encoded integers differently. */
if (zipTryEncoding(sstr,slen,&sval,&sencoding)) {
- if (entry.encoding == sencoding) {
- zval = zipLoadInteger(p+entry.headersize,entry.encoding);
- return zval == sval;
- }
+ zval = zipLoadInteger(p+entry.headersize,entry.encoding);
+ return zval == sval;
}
}
return 0;