The list was unfortunately halved in size every time an element
was taken from it, which was great for performance, but shortened
the result substantially.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
struct loc_network* network = list->elements[0];
// Move all elements to the top of the stack
- for (unsigned int i = 0; i < --list->size; i++) {
+ for (unsigned int i = 0; i < list->size - 1; i++) {
list->elements[i] = list->elements[i+1];
}
+ // The list is shorter now
+ --list->size;
+
DEBUG(list->ctx, "%p: Popping network %p from stack\n", list, network);
return network;