From bb57b965c4252a48472d99a1b2e7a30d66d65796 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Sat, 29 May 2010 16:37:47 +0200 Subject: [PATCH] use the entry struct in zipRawEntryLength --- ziplist.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ziplist.c b/ziplist.c index d3e3cbaa..16e9dbc1 100644 --- 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. */ -- 2.47.2