Commit 1dfcd75a authored by Matt Stancliff's avatar Matt Stancliff
Browse files

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.
parent 53b1ee34
......@@ -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 int vlen;
long long vlong;
......@@ -1034,7 +1034,7 @@ static void pop(unsigned char *zl, int where) {
}
printf("\n");
ziplistDeleteRange(zl,-1,1);
return ziplistDelete(zl,&p);
} else {
printf("ERROR: Could not pop\n");
exit(1);
......@@ -1099,16 +1099,16 @@ int ziplistTest(int argc, char **argv) {
zl = createList();
ziplistRepr(zl);
pop(zl,ZIPLIST_TAIL);
zl = pop(zl,ZIPLIST_TAIL);
ziplistRepr(zl);
pop(zl,ZIPLIST_HEAD);
zl = pop(zl,ZIPLIST_HEAD);
ziplistRepr(zl);
pop(zl,ZIPLIST_TAIL);
zl = pop(zl,ZIPLIST_TAIL);
ziplistRepr(zl);
pop(zl,ZIPLIST_TAIL);
zl = pop(zl,ZIPLIST_TAIL);
ziplistRepr(zl);
printf("Get element at index 3:\n");
......
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