summaryrefslogtreecommitdiff
path: root/src/ziplist.h
diff options
context:
space:
mode:
authorMatt Stancliff <matt@genges.com>2014-11-21 14:52:10 -0500
committerMatt Stancliff <matt@genges.com>2015-01-02 11:16:08 -0500
commit9d2dc0249c5ef99586710d711e1381c4178aeb39 (patch)
tree1cdbd8e8e636f5fa1ef45bb17a7edd27c5905c76 /src/ziplist.h
parent5e362b84ab8b769bf2738daea97b45a375d223f1 (diff)
downloadredis-9d2dc0249c5ef99586710d711e1381c4178aeb39.tar.gz
Add ziplistMerge()
This started out as #2158 by sunheehnus, but I kept rewriting it until I could understand things more easily and get a few more correctness guarantees out of the readability flow. The original commit created and returned a new ziplist with the contents of both input ziplists, but I prefer to grow one of the input ziplists and destroy the other one. So, instead of malloc+copy as in #2158, the merge now reallocs one of the existing ziplists and copies the other ziplist into the new space. Also added merge test cases to ziplistTest()
Diffstat (limited to 'src/ziplist.h')
-rw-r--r--src/ziplist.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/ziplist.h b/src/ziplist.h
index ef0e27140..e92b5e783 100644
--- a/src/ziplist.h
+++ b/src/ziplist.h
@@ -32,6 +32,7 @@
#define ZIPLIST_TAIL 1
unsigned char *ziplistNew(void);
+unsigned char *ziplistMerge(unsigned char **first, unsigned char **second);
unsigned char *ziplistPush(unsigned char *zl, unsigned char *s, unsigned int slen, int where);
unsigned char *ziplistIndex(unsigned char *zl, int index);
unsigned char *ziplistNext(unsigned char *zl, unsigned char *p);