Commit 6a8e35ad authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

ziplistDelete no longer needs a direction now ziplistPrev is fixed

parent 8632fb30
...@@ -482,7 +482,7 @@ unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, char *s, unsig ...@@ -482,7 +482,7 @@ unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, char *s, unsig
/* Delete a single entry from the ziplist, pointed to by *p. /* Delete a single entry from the ziplist, pointed to by *p.
* Also update *p in place, to be able to iterate over the * Also update *p in place, to be able to iterate over the
* ziplist, while deleting entries. */ * ziplist, while deleting entries. */
unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p, int direction) { unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p) {
unsigned int offset = *p-zl; unsigned int offset = *p-zl;
zl = __ziplistDelete(zl,*p,1); zl = __ziplistDelete(zl,*p,1);
...@@ -490,11 +490,7 @@ unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p, int direction ...@@ -490,11 +490,7 @@ unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p, int direction
* do a realloc which might result in a different "zl"-pointer. * do a realloc which might result in a different "zl"-pointer.
* When the delete direction is back to front, we might delete the last * When the delete direction is back to front, we might delete the last
* entry and end up with "p" pointing to ZIP_END, so check this. */ * entry and end up with "p" pointing to ZIP_END, so check this. */
if (*(zl+offset) == ZIP_END && direction == ZIPLIST_HEAD) { *p = zl+offset;
*p = ZIPLIST_ENTRY_TAIL(zl);
} else {
*p = zl+offset;
}
return zl; return zl;
} }
......
...@@ -9,7 +9,7 @@ unsigned char *ziplistNext(unsigned char *zl, unsigned char *p); ...@@ -9,7 +9,7 @@ unsigned char *ziplistNext(unsigned char *zl, unsigned char *p);
unsigned char *ziplistPrev(unsigned char *zl, unsigned char *p); unsigned char *ziplistPrev(unsigned char *zl, unsigned char *p);
unsigned int ziplistGet(unsigned char *p, char **sstr, unsigned int *slen, long long *sval); unsigned int ziplistGet(unsigned char *p, char **sstr, unsigned int *slen, long long *sval);
unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, char *s, unsigned int slen); unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, char *s, unsigned int slen);
unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p, int direction); unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p);
unsigned char *ziplistDeleteRange(unsigned char *zl, unsigned int index, unsigned int num); unsigned char *ziplistDeleteRange(unsigned char *zl, unsigned int index, unsigned int num);
unsigned int ziplistCompare(unsigned char *p, char *entry, unsigned int elen); unsigned int ziplistCompare(unsigned char *p, char *entry, unsigned int elen);
unsigned int ziplistLen(unsigned char *zl); unsigned int ziplistLen(unsigned char *zl);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment