summaryrefslogtreecommitdiff
path: root/src/listpack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/listpack.c')
-rw-r--r--src/listpack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/listpack.c b/src/listpack.c
index abe2142de..f36d9d64d 100644
--- a/src/listpack.c
+++ b/src/listpack.c
@@ -1209,6 +1209,13 @@ unsigned char *lpMerge(unsigned char **first, unsigned char **second) {
return target;
}
+unsigned char *lpDup(unsigned char *lp) {
+ size_t lpbytes = lpBytes(lp);
+ unsigned char *newlp = lp_malloc(lpbytes);
+ memcpy(newlp, lp, lpbytes);
+ return newlp;
+}
+
/* Return the total number of bytes the listpack is composed of. */
size_t lpBytes(unsigned char *lp) {
return lpGetTotalBytes(lp);