]> git.saurik.com Git - redis.git/commitdiff
modify compare function to check if the encoding is equal before comparing
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 29 May 2010 14:22:24 +0000 (16:22 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 29 May 2010 19:10:16 +0000 (21:10 +0200)
ziplist.c

index 50b92514f5480adb59af75d6a577cc01cba3209f..08253f37e63d7f6cf5d0e2dcbcbf426aedf59e8c 100644 (file)
--- 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;