]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Employ proper API to iterate through hash table entries
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 16 May 2022 22:20:56 +0000 (17:20 -0500)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 16 May 2022 22:20:56 +0000 (17:20 -0500)
Found this quirk while eyeballing #83. I don't think it's going to
fix the problem, but it's definitely an improvement.

src/rtr/db/db_table.c

index cf2e795db7f25607f066c024f00ee8ec06bec03e..11eab2cbe41658a5d0419cbf5c1779ebc379e8eb 100644 (file)
@@ -254,9 +254,10 @@ add_roa_deltas(struct hashable_roa *roas1, struct hashable_roa *roas2,
 {
        struct hashable_roa *n1; /* A node from @roas1 */
        struct hashable_roa *n2; /* A node from @roas2 */
+       struct hashable_roa *tmp;
        int error;
 
-       for (n1 = roas1; n1 != NULL; n1 = n1->hh.next) {
+       HASH_ITER(hh, roas1, n1, tmp) {
                HASH_FIND(hh, roas2, &n1->data, sizeof(n1->data), n2);
                if (n2 == NULL) {
                        error = deltas_add_roa(deltas, &n1->data, op);