• Matt Stancliff's avatar
    Add ziplistMerge() · 9d2dc024
    Matt Stancliff authored
    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()
    9d2dc024
ziplist.c 59.4 KB