Light refactoring of catz.c

* Change 'dns_catz_new_zones()' function's prototype (the order of the
  arguments) to synchronize it with the similar function in rpz.c.
* Rename 'refs' to 'references' in preparation of ISC_REFCOUNT_*
  macros usage for reference tracking.
* Unify dns_catz_zone_t naming to catz, and dns_catz_zones_t naming to
  catzs, following the logic of similar changes in rpz.c.
* Use C compound literals for structure initialization.
* Synchronize the "new zone version came too soon" log message with the
  one in rpz.c.
* Use more of 'sizeof(*ptr)' style instead of the 'sizeof(type_t)' style
  expressions when allocating or freeing memory for 'ptr'.

(cherry picked from commit 8cb79fec9d)
This commit is contained in:
Aram Sargsyan 2023-02-27 18:24:34 +00:00
parent ca9bbd43c6
commit 43d99eb8b8
3 changed files with 367 additions and 381 deletions

View file

@ -3174,9 +3174,8 @@ configure_catz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *config,
return (ISC_R_SUCCESS);
}
CHECK(dns_catz_new_zones(&view->catzs, &ns_catz_zonemodmethods,
view->mctx, named_g_taskmgr,
named_g_timermgr));
CHECK(dns_catz_new_zones(view->mctx, named_g_taskmgr, named_g_timermgr,
&view->catzs, &ns_catz_zonemodmethods));
if (pview != NULL) {
old = pview->catzs;

File diff suppressed because it is too large Load diff

View file

@ -144,7 +144,7 @@ dns_catz_entry_new(isc_mem_t *mctx, const dns_name_t *domain,
*/
void
dns_catz_entry_copy(dns_catz_zone_t *zone, const dns_catz_entry_t *entry,
dns_catz_entry_copy(dns_catz_zone_t *catz, const dns_catz_entry_t *entry,
dns_catz_entry_t **nentryp);
/*%<
* Allocate a new catz_entry and deep copy 'entry' into 'nentryp'.
@ -170,7 +170,7 @@ dns_catz_entry_attach(dns_catz_entry_t *entry, dns_catz_entry_t **entryp);
*/
void
dns_catz_entry_detach(dns_catz_zone_t *zone, dns_catz_entry_t **entryp);
dns_catz_entry_detach(dns_catz_zone_t *catz, dns_catz_entry_t **entryp);
/*%<
* Detach an entry, free if no further references
*
@ -223,14 +223,14 @@ dns_catz_zone_detach(dns_catz_zone_t **zonep);
*/
isc_result_t
dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep,
dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **catzp,
const dns_name_t *name);
/*%<
* Allocate a new catz zone on catzs mctx
*
* Requires:
* \li 'catzs' is a valid dns_catz_zones_t.
* \li 'zonep' is not NULL and '*zonep' is NULL.
* \li 'catzp' is not NULL and '*zonep' is NULL.
* \li 'name' is a valid dns_name_t.
*
*/
@ -334,14 +334,17 @@ struct dns_catz_zonemodmethods {
};
isc_result_t
dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm,
isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
isc_timermgr_t *timermgr);
dns_catz_new_zones(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
isc_timermgr_t *timermgr, dns_catz_zones_t **catzsp,
dns_catz_zonemodmethods_t *zmm);
/*%<
* Allocate a new catz_zones object, a collection storing all catalog zones
* for a view.
*
* Requires:
* \li 'mctx' is not NULL.
* \li 'taskmgr' is not NULL.
* \li 'timermgr' is not NULL.
* \li 'catzsp' is not NULL and '*catzsp' is NULL.
* \li 'zmm' is not NULL.
*