]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/database.c
Remove some dead code and add some comments
[people/ms/libloc.git] / src / database.c
index 671854e8d5ad2d9ddf54fa0f862557deffd4a87d..710fa5641fe37c5708d6bb831111d9354fdb66c6 100644 (file)
@@ -606,6 +606,9 @@ static void loc_database_enumerator_free(struct loc_database_enumerator* enumera
        if (enumerator->string)
                free(enumerator->string);
 
+       // Free network search
+       free(enumerator->networks_visited);
+
        free(enumerator);
 }
 
@@ -722,12 +725,10 @@ static int loc_database_enumerator_network_depth_first_search(
                        continue;
                }
 
+               // Mark the bits on the path correctly
                in6_addr_set_bit(&e->network_address,
                        (node->depth > 0) ? node->depth - 1 : 0, node->i);
 
-               //for (unsigned int i = stack->depth + 1; i < 128; i++)
-               //      in6_addr_set_bit(&e->network_address, i, 0);
-
                DEBUG(e->ctx, "Looking at node %jd\n", node->offset);
                e->networks_visited[node->offset]++;
 
@@ -775,7 +776,10 @@ static int loc_database_enumerator_network_depth_first_search(
        }
 
        // Reached the end of the search
-       // TODO cleanup
+
+       // Mark all nodes as non-visited
+       for (unsigned int i = 0; i < e->db->network_nodes_count; i++)
+               e->networks_visited[i] = 0;
 
        return 0;
 }