]> git.ipfire.org Git - location/libloc.git/blobdiff - src/database.c
network: Add function to pop first element from stack
[location/libloc.git] / src / database.c
index 6849d97abb9dadb02eaea94a9e8cc45e76993fb7..b9d870f44a7dd8ffc84b310f46624d1a040804e0 100644 (file)
@@ -1315,15 +1315,13 @@ static int __loc_database_enumerator_next_network_flattened(
                goto END;
        }
 
-       // Reverse the list
-       loc_network_list_reverse(excluded);
-
        // Replace network with the first one
        loc_network_unref(*network);
 
-       *network = loc_network_list_pop(excluded);
+       *network = loc_network_list_pop_first(excluded);
 
        // Push the rest onto the stack
+       loc_network_list_reverse(excluded);
        loc_network_list_merge(enumerator->stack, excluded);
 
        loc_network_list_unref(excluded);