mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
ziplistDelete no longer needs a direction now ziplistPrev is fixed
This commit is contained in:
parent
8632fb3040
commit
6a8e35ad92
@ -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
|
|||||||
* 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 = ZIPLIST_ENTRY_TAIL(zl);
|
|
||||||
} else {
|
|
||||||
*p = zl+offset;
|
*p = zl+offset;
|
||||||
}
|
|
||||||
return zl;
|
return zl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user