mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Fix ziplist test for pop()
The previous test wasn't returning the new ziplist, so the test was invalid. Now the test works properly. These problems were simultaenously discovered in #2154 and that PR also had an additional fix we included here.
This commit is contained in:
parent
53b1ee34dd
commit
1dfcd75ae3
@ -1014,7 +1014,7 @@ static void stress(int pos, int num, int maxsize, int dnum) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pop(unsigned char *zl, int where) {
|
static unsigned char *pop(unsigned char *zl, int where) {
|
||||||
unsigned char *p, *vstr;
|
unsigned char *p, *vstr;
|
||||||
unsigned int vlen;
|
unsigned int vlen;
|
||||||
long long vlong;
|
long long vlong;
|
||||||
@ -1034,7 +1034,7 @@ static void pop(unsigned char *zl, int where) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
ziplistDeleteRange(zl,-1,1);
|
return ziplistDelete(zl,&p);
|
||||||
} else {
|
} else {
|
||||||
printf("ERROR: Could not pop\n");
|
printf("ERROR: Could not pop\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -1099,16 +1099,16 @@ int ziplistTest(int argc, char **argv) {
|
|||||||
zl = createList();
|
zl = createList();
|
||||||
ziplistRepr(zl);
|
ziplistRepr(zl);
|
||||||
|
|
||||||
pop(zl,ZIPLIST_TAIL);
|
zl = pop(zl,ZIPLIST_TAIL);
|
||||||
ziplistRepr(zl);
|
ziplistRepr(zl);
|
||||||
|
|
||||||
pop(zl,ZIPLIST_HEAD);
|
zl = pop(zl,ZIPLIST_HEAD);
|
||||||
ziplistRepr(zl);
|
ziplistRepr(zl);
|
||||||
|
|
||||||
pop(zl,ZIPLIST_TAIL);
|
zl = pop(zl,ZIPLIST_TAIL);
|
||||||
ziplistRepr(zl);
|
ziplistRepr(zl);
|
||||||
|
|
||||||
pop(zl,ZIPLIST_TAIL);
|
zl = pop(zl,ZIPLIST_TAIL);
|
||||||
ziplistRepr(zl);
|
ziplistRepr(zl);
|
||||||
|
|
||||||
printf("Get element at index 3:\n");
|
printf("Get element at index 3:\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user