]> git.saurik.com Git - redis.git/commitdiff
use the entry struct in zipRawEntryLength
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 29 May 2010 14:37:47 +0000 (16:37 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 29 May 2010 19:10:17 +0000 (21:10 +0200)
ziplist.c

index d3e3cbaa46982af0511cf21c2c1d7833309b7b1d..16e9dbc1ea5db807771cae45e53b4627ea9e0fd4 100644 (file)
--- a/ziplist.c
+++ b/ziplist.c
@@ -209,14 +209,10 @@ static zlentry zipEntry(unsigned char *p) {
     return e;
 }
 
-/* Return the total amount used by an entry (encoded length + payload). */
+/* Return the total number of bytes used by the entry at "p". */
 static unsigned int zipRawEntryLength(unsigned char *p) {
-    unsigned int prevlensize, lensize, len;
-    /* Byte-size of encoded length of previous entry */
-    zipDecodeLength(p,&prevlensize);
-    /* Encoded length of this entry's payload */
-    len = zipDecodeLength(p+prevlensize, &lensize);
-    return prevlensize+lensize+len;
+    zlentry e = zipEntry(p);
+    return e.headersize + e.len;
 }
 
 /* Create a new empty ziplist. */