]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Delete optimistically from rpz nodes hashtable
authorAlessio Podda <alessio@isc.org>
Mon, 9 Mar 2026 23:12:54 +0000 (00:12 +0100)
committerAlessio Podda <alessio@isc.org>
Mon, 3 Aug 2026 12:31:44 +0000 (14:31 +0200)
Instead of checking whether an element is present and then deleting it,
we can try to delete it optimistically and then rely on the result to
know if the element was present or not.

lib/dns/rpz.c

index 320dcd2589dd1171b5d16840eb6a61c46818c281..81cfb44bcfd6a4dd30badaebef4eaab283e6c962 100644 (file)
@@ -1870,10 +1870,8 @@ update_nodes(dns_rpz_zone_t *rpz, isc_ht_t *newnodes) {
                }
 
                /* Does the entry exist in the old nodes table? */
-               result = isc_ht_find(rpz->nodes, name->ndata, name->length,
-                                    NULL);
+               result = isc_ht_delete(rpz->nodes, name->ndata, name->length);
                if (result == ISC_R_SUCCESS) { /* found */
-                       isc_ht_delete(rpz->nodes, name->ndata, name->length);
                        goto next;
                }