ERROR(db->ctx, "Could not unmap network nodes section: %s\n", strerror(errno));
}
+ // Remove mapped countries section
+ if (db->countries_v1) {
+ r = munmap(db->countries_v1, db->countries_count * sizeof(*db->countries_v1));
+ if (r)
+ ERROR(db->ctx, "Could not unmap countries section: %s\n", strerror(errno));
+ }
+
if (db->pool)
loc_stringpool_unref(db->pool);
loc_network_list_unref(subnets);
loc_network_list_unref(excluded);
- // Replace network with the first one from the stack
+ // Drop the network and restart the whole process again to pick the next network
loc_network_unref(*network);
- *network = loc_network_list_pop_first(enumerator->stack);
- return 0;
+ return __loc_database_enumerator_next_network_flattened(enumerator, network);
}
LOC_EXPORT int loc_database_enumerator_next_network(