m = sl->top;
while (m) {
int compared;
- if (m->next) {
- compared = comp(data, m->next->data);
- }
+ compared = (m->next) ? comp(data, m->next->data) : -1;
if (compared == 0) {
m = m->next;
while (m->down) {
return count;
}
if ((m->next == NULL) || (compared < 0)) {
- m = m->down, count++;
+ m = m->down;
+ count++;
}
else {
- m = m->next, count++;
+ m = m->next;
+ count++;
}
}
*ret = NULL;
if (m->nextindex) {
skiplisti_remove(m->nextindex->sl, m->nextindex, NULL);
}
- else {
- sl->size--;
- }
-
while (m->up) {
m = m->up;
}
}
skiplist_free(sl, p);
}
+ sl->size--;
while (sl->top && sl->top->next == NULL) {
/* While the row is empty and we are not on the bottom row */
p = sl->top;
sl->bottom = NULL;
}
AP_DEBUG_ASSERT(sl->height >= 0);
- return sl->height;
+ return sl->height; /* return 1; ?? */
}
int skiplist_remove_compare(Skiplist *sli,