]> git.saurik.com Git - redis.git/commitdiff
add function to retrieve ziplist size in bytes
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 29 May 2010 09:33:38 +0000 (11:33 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 29 May 2010 19:10:16 +0000 (21:10 +0200)
ziplist.c
ziplist.h

index 3dc534d31397ae1b7bd90ff40e8c3001267ead79..4b4c568dafb130eb84f295bcf889275cbd00b559 100644 (file)
--- a/ziplist.c
+++ b/ziplist.c
@@ -411,6 +411,11 @@ unsigned int ziplistLen(unsigned char *zl) {
     return len;
 }
 
+/* Return size in bytes of ziplist. */
+unsigned int ziplistSize(unsigned char *zl) {
+    return ZIPLIST_BYTES(zl);
+}
+
 void ziplistRepr(unsigned char *zl) {
     unsigned char *p, encoding;
     unsigned int l, lsize;
index cea7f5dee442f2f1529fd2d280c496b2f2600dba..fecfe9b65dda961c9b2286780a26320e98d97f11 100644 (file)
--- a/ziplist.h
+++ b/ziplist.h
@@ -10,4 +10,5 @@ unsigned int ziplistGet(unsigned char *p, unsigned char **e, unsigned int *elen,
 unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p);
 unsigned char *ziplistDeleteRange(unsigned char *zl, unsigned int index, unsigned int num);
 unsigned int ziplistCompare(unsigned char *p, unsigned char *entry, unsigned int elen);
-unsigned int ziplistLen(unsigned char *zl);
\ No newline at end of file
+unsigned int ziplistLen(unsigned char *zl);
+unsigned int ziplistSize(unsigned char *zl);