Commit 3c6f5df2 authored by Jan Kadlec's avatar Jan Kadlec

getter cleanup: Removed zone apex getter.

parent 8f687090
......@@ -155,8 +155,7 @@ static int ns_put_nsec3_closest_encloser_proof(
if (knot_zone_contents_nsec3params(zone) == NULL) {
dbg_ns_exec_verb(
char *name = knot_dname_to_str(knot_node_owner(
knot_zone_contents_apex(zone)));
char *name = knot_dname_to_str(zone->apex->owner);
dbg_ns_verb("No NSEC3PARAM found in zone %s.\n", name);
free(name);
);
......@@ -516,7 +515,7 @@ dbg_ns_exec_verb(
dbg_ns_verb("Previous node: %s\n", name);
free(name);
);
assert(prev_new != knot_zone_contents_apex(zone));
assert(prev_new != zone->apex);
prev_new = prev_new->prev;
}
assert(knot_dname_cmp(prev_new->owner, wildcard) < 0);
......
......@@ -560,7 +560,7 @@ int knot_ns_switch_zone(knot_ns_xfr_t *xfr)
* a reload occurs when transfer is pending. */
zone_t *z = xfr->zone;
if (z == NULL) {
char *name = knot_dname_to_str(knot_zone_contents_apex(zone)->owner);
char *name = knot_dname_to_str(zone->apex->owner);
dbg_xfr("Failed to replace zone %s, old zone "
"not found\n", name);
free(name);
......
......@@ -1152,7 +1152,7 @@ int zones_save_zone(const knot_ns_xfr_t *xfr)
/* Check if the new zone apex dname matches zone name. */
knot_dname_t *cur_name = knot_dname_from_str(xfr->zone->conf->name);
const knot_dname_t *new_name = NULL;
new_name = knot_zone_contents_apex(new_zone)->owner;
new_name = new_zone->apex->owner;
int r = knot_dname_cmp(cur_name, new_name);
knot_dname_free(&cur_name, NULL);
if (r != 0) {
......
......@@ -81,9 +81,9 @@ int xfrin_transfer_needed(const knot_zone_contents_t *zone,
* Retrieve the local Serial
*/
const knot_rdataset_t *soa_rrs =
knot_node_rdataset(knot_zone_contents_apex(zone), KNOT_RRTYPE_SOA);
knot_node_rdataset(zone->apex, KNOT_RRTYPE_SOA);
if (soa_rrs == NULL) {
char *name = knot_dname_to_str(knot_zone_contents_apex(zone)->owner);
char *name = knot_dname_to_str(zone->apex->owner);
dbg_xfrin("SOA RRSet missing in the zone %s!\n", name);
free(name);
return KNOT_ERROR;
......@@ -1091,7 +1091,7 @@ int xfrin_prepare_zone_copy(knot_zone_contents_t *old_contents,
return ret;
}
assert(knot_zone_contents_apex(contents_copy) != NULL);
assert(contents_copy->apex != NULL);
*new_contents = contents_copy;
......@@ -1140,7 +1140,7 @@ int xfrin_finalize_updated_zone(knot_zone_contents_t *contents_copy,
return ret;
}
assert(knot_zone_contents_apex(contents_copy) != NULL);
assert(contents_copy->apex != NULL);
return KNOT_EOK;
}
......@@ -1250,7 +1250,7 @@ int xfrin_apply_changesets(zone_t *zone,
return ret;
}
}
assert(knot_zone_contents_apex(contents_copy) != NULL);
assert(contents_copy->apex != NULL);
/*!
* \todo Test failure of IXFR.
......
......@@ -655,7 +655,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
}
/* Result is a dname, it can't be larger */
const knot_node_t *apex = knot_zone_contents_apex(zone);
const knot_node_t *apex = zone->apex;
uint8_t *next_dname_str = NULL;
uint8_t next_dname_size = 0;
knot_nsec3_next_hashed(nsec3_rrs, 0, &next_dname_str,
......@@ -770,7 +770,7 @@ static int sem_check_node_optional(const knot_zone_contents_t *zone,
const knot_node_t *node,
err_handler_t *handler)
{
if (!((node->flags & KNOT_NODE_FLAGS_DELEG) || knot_zone_contents_apex(zone) ==
if (!((node->flags & KNOT_NODE_FLAGS_DELEG) || zone->apex ==
node)) {
return KNOT_EOK;
}
......@@ -789,7 +789,7 @@ static int sem_check_node_optional(const knot_zone_contents_t *zone,
knot_zone_contents_find_node(zone, ns_dname);
if (knot_dname_is_sub(ns_dname,
knot_zone_contents_apex(zone)->owner)) {
zone->apex->owner)) {
if (glue_node == NULL) {
/* Try wildcard ([1]* + suffix). */
knot_dname_t wildcard[KNOT_DNAME_MAXLEN];
......@@ -1075,7 +1075,7 @@ void log_cyclic_errors_in_zone(err_handler_t *handler,
}
/* Result is a dname, it can't be larger */
const knot_node_t *apex = knot_zone_contents_apex(zone);
const knot_node_t *apex = zone->apex;
uint8_t *next_dname_str = NULL;
uint8_t next_dname_size = 0;
knot_nsec3_next_hashed(nsec3_rrs, 0, &next_dname_str,
......@@ -1122,7 +1122,7 @@ void log_cyclic_errors_in_zone(err_handler_t *handler,
assert(next_dname);
const knot_dname_t *apex_dname =
knot_zone_contents_apex(zone)->owner;
zone->apex->owner;
assert(apex_dname);
if (knot_dname_cmp(next_dname, apex_dname) !=0) {
......
......@@ -1116,18 +1116,6 @@ dbg_zone_exec_detail(
/*----------------------------------------------------------------------------*/
const knot_node_t *knot_zone_contents_apex(
const knot_zone_contents_t *zone)
{
if (zone == NULL) {
return NULL;
}
return zone->apex;
}
/*----------------------------------------------------------------------------*/
const knot_node_t *knot_zone_contents_find_wildcard_child(
const knot_zone_contents_t *contents, const knot_node_t *parent)
{
......@@ -1453,7 +1441,7 @@ uint32_t knot_zone_serial(const knot_zone_contents_t *zone)
{
if (!zone) return 0;
const knot_rdataset_t *soa = NULL;
soa = knot_node_rdataset(knot_zone_contents_apex(zone), KNOT_RRTYPE_SOA);
soa = knot_node_rdataset(zone->apex, KNOT_RRTYPE_SOA);
uint32_t serial = knot_soa_serial(soa);
return serial;
}
......
......@@ -188,15 +188,6 @@ int knot_zone_contents_find_nsec3_for_name(
const knot_dname_t *name,
const knot_node_t **nsec3_node,
const knot_node_t **nsec3_previous);
/*!
* \brief Returns the apex node of the zone.
*
* \param zone Zone to get the apex of.
*
* \return Zone apex node.
*/
const knot_node_t *knot_zone_contents_apex(
const knot_zone_contents_t *contents);
const knot_node_t *knot_zone_contents_find_wildcard_child(
const knot_zone_contents_t *contents, const knot_node_t *parent);
......
......@@ -43,8 +43,8 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
return KNOT_EINVAL;
}
const knot_node_t *apex1 = knot_zone_contents_apex(zone1);
const knot_node_t *apex2 = knot_zone_contents_apex(zone2);
const knot_node_t *apex1 = zone1->apex;
const knot_node_t *apex2 = zone2->apex;
if (apex1 == NULL || apex2 == NULL) {
return KNOT_EINVAL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment