From: Colin Vidal Date: Mon, 24 Nov 2025 10:28:48 +0000 (+0100) Subject: add type to hooktable_free callbacks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4902fff81a72a0c74b7de05d87c0edce19af9efd;p=thirdparty%2Fbind9.git add type to hooktable_free callbacks The `hootable_free` callbacks (used in views and zones) are now typed with `dns_hooktable_free_t`, as the hook definitions are now part of libdns. --- diff --git a/lib/dns/hooks.c b/lib/dns/hooks.c index 09bb5df26d4..fccb7453d5d 100644 --- a/lib/dns/hooks.c +++ b/lib/dns/hooks.c @@ -298,7 +298,7 @@ dns_hooktable_create(isc_mem_t *mctx, dns_hooktable_t **tablep) { } void -dns_hooktable_free(isc_mem_t *mctx, void **tablep) { +dns_hooktable_free(isc_mem_t *mctx, dns_hooktable_t **tablep) { dns_hooktable_t *table = NULL; int i = 0; diff --git a/lib/dns/include/dns/hooks.h b/lib/dns/include/dns/hooks.h index 34b1e53ae21..0b902dc4336 100644 --- a/lib/dns/include/dns/hooks.h +++ b/lib/dns/include/dns/hooks.h @@ -443,6 +443,8 @@ typedef struct dns_hook { typedef ISC_LIST(dns_hook_t) dns_hooklist_t; typedef dns_hooklist_t dns_hooktable_t[DNS_HOOKPOINTS_COUNT]; +typedef void (*dns_hooktable_free_t)(isc_mem_t *, dns_hooktable_t **); + /*% * dns__hook_table is a global hook table, which is used if view->hooktable * is NULL. It's intended only for use by unit tests. @@ -638,7 +640,7 @@ dns_plugins_free(isc_mem_t *mctx, void **listp); */ void -dns_hooktable_free(isc_mem_t *mctx, void **tablep); +dns_hooktable_free(isc_mem_t *mctx, dns_hooktable_t **tablep); /*%< * Free a hook table. */ diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index bb74c0a2c63..2228f438d1c 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -69,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -243,8 +244,8 @@ struct dns_view { void (*plugins_free)(isc_mem_t *, void **); /* Hook table */ - void *hooktable; /* dns_hooktable */ - void (*hooktable_free)(isc_mem_t *, void **); + dns_hooktable_t *hooktable; + dns_hooktable_free_t hooktable_free; }; #define DNS_VIEW_MAGIC ISC_MAGIC('V', 'i', 'e', 'w') diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index d9821e7213b..667f62a07f5 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -2719,7 +2720,7 @@ dns_zone_getkeystores(dns_zone_t *zone); * initialized. */ -void * +dns_hooktable_t * dns_zone_gethooktable(dns_zone_t *zone); /**< * Returns the zone hooktable @@ -2730,7 +2731,7 @@ dns_zone_gethooktable(dns_zone_t *zone); void dns_zone_sethooktable(dns_zone_t *zone, void *hooktable, - void (*hooktable_free)(isc_mem_t *, void **)); + dns_hooktable_free_t hooktable_free); /**< * Initialize zone hooktable and free callback * diff --git a/lib/dns/zone.c b/lib/dns/zone.c index a46969b3e8e..bef967b9a26 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -525,8 +525,8 @@ struct dns_zone { */ void *plugins; void (*plugins_free)(isc_mem_t *, void **); - void *hooktable; - void (*hooktable_free)(isc_mem_t *, void **); + dns_hooktable_t *hooktable; + dns_hooktable_free_t hooktable_free; /* Configuration text */ char *cfg; @@ -24005,7 +24005,7 @@ dns_zone_setrad(dns_zone_t *zone, dns_name_t *name) { rcu_read_unlock(); } -void * +dns_hooktable_t * dns_zone_gethooktable(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return zone->hooktable; @@ -24013,7 +24013,7 @@ dns_zone_gethooktable(dns_zone_t *zone) { void dns_zone_sethooktable(dns_zone_t *zone, void *hooktable, - void (*hooktable_free)(isc_mem_t *, void **)) { + dns_hooktable_free_t hooktable_free) { REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(zone->hooktable == NULL); REQUIRE(zone->hooktable_free == NULL); diff --git a/tests/libtest/ns.c b/tests/libtest/ns.c index e8e432fd47c..628ee2f4c9d 100644 --- a/tests/libtest/ns.c +++ b/tests/libtest/ns.c @@ -401,7 +401,7 @@ create_qctx_for_client(ns_client_t *client, query_ctx_t **qctxp) { ns_query_start(client, client->inner.handle); dns__hook_table = saved_hook_table; - dns_hooktable_free(isc_g_mctx, (void **)&query_hooks); + dns_hooktable_free(isc_g_mctx, &query_hooks); isc_nmhandle_detach(&client->inner.reqhandle);