Commit 72e60040 authored by Jan Kadlec's avatar Jan Kadlec

Renamed list wrapper structures.

Refs #102
parent f695fbd5
......@@ -2712,7 +2712,7 @@ int zones_changeset_binary_size(const knot_changeset_t *chgset, size_t *size)
size_t soa_to_size = rrset_binary_size(chgset->soa_to);
size_t remove_size = 0;
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
WALK_LIST(rr_node, chgset->remove) {
knot_rrset_t *rrset = rr_node->rr;
remove_size += rrset_binary_size(rrset);
......@@ -2767,7 +2767,7 @@ static int zones_serialize_and_store_chgset(const knot_changeset_t *chs,
}
/* Serialize RRSets from the 'remove' section. */
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
WALK_LIST(rr_node, chs->remove) {
knot_rrset_t *rrset = rr_node->rr;
ret = zones_rrset_write_to_mem(rrset, &entry, &max_size);
......
......@@ -2872,7 +2872,7 @@ static int ns_ixfr_put_changeset(knot_ns_xfr_t *xfr,
}
// 2) put remove RRSets
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
WALK_LIST(rr_node, chgset->remove) {
knot_rrset_t *rr_rem = rr_node->rr;
res = ns_ixfr_put_rrset(xfr, rr_rem);
......
......@@ -50,7 +50,7 @@ int knot_changesets_init(knot_changesets_t **changesets, uint32_t flags)
(*changesets)->mmc_chs.free = NULL;
// Initialize memory context for RRs in changesets (xmalloc'd)
struct mempool *rr_pool = mp_new(sizeof(knot_rr_node_t));
struct mempool *rr_pool = mp_new(sizeof(knot_rr_ln_t));
(*changesets)->mmc_rr.ctx = rr_pool;
(*changesets)->mmc_rr.alloc = (mm_alloc_t)mp_alloc;
(*changesets)->mmc_rr.free = NULL;
......@@ -126,8 +126,8 @@ int knot_changeset_add_rrset(knot_changeset_t *chgs, knot_rrset_t *rrset,
knot_changeset_part_t part)
{
// Create wrapper node for list
knot_rr_node_t *rr_node =
chgs->mem_ctx.alloc(chgs->mem_ctx.ctx, sizeof(knot_rr_node_t));
knot_rr_ln_t *rr_node =
chgs->mem_ctx.alloc(chgs->mem_ctx.ctx, sizeof(knot_rr_ln_t));
if (rr_node == NULL) {
// This will not happen with mp_alloc, but allocator can change
ERR_ALLOC_FAILED;
......@@ -151,7 +151,7 @@ int knot_changeset_add_rr(knot_changeset_t *chgs, knot_rrset_t *rr,
// otherwise just add the RR to the end of the list
list *l = part == KNOT_CHANGESET_ADD ? &(chgs->add) : &(chgs->remove);
knot_rrset_t *tail_rr =
EMPTY_LIST(*l) ? NULL : ((knot_rr_node_t *)(TAIL(*l)))->rr;
EMPTY_LIST(*l) ? NULL : ((knot_rr_ln_t *)(TAIL(*l)))->rr;
if (tail_rr && knot_changeset_rrsets_match(tail_rr, rr)) {
// Create changesets exactly as they came, with possibly
......@@ -174,8 +174,8 @@ int knot_changes_add_rrset(knot_changes_t *ch, knot_rrset_t *rrset,
return KNOT_EINVAL;
}
knot_rr_node_t *rr_node =
ch->mem_ctx.alloc(ch->mem_ctx.ctx, sizeof(knot_rr_node_t));
knot_rr_ln_t *rr_node =
ch->mem_ctx.alloc(ch->mem_ctx.ctx, sizeof(knot_rr_ln_t));
if (rr_node == NULL) {
// This will not happen with mp_alloc, but allocator can change
ERR_ALLOC_FAILED;
......@@ -201,8 +201,8 @@ int knot_changes_add_node(knot_changes_t *ch, knot_node_t *kn_node,
}
// Using the same allocator for node and rr's, sizes are equal.
knot_node_list_t *list_node =
ch->mem_ctx.alloc(ch->mem_ctx.ctx, sizeof(knot_node_list_t));
knot_node_ln_t *list_node =
ch->mem_ctx.alloc(ch->mem_ctx.ctx, sizeof(knot_node_ln_t));
if (list_node == NULL) {
// This will not happen with mp_alloc, but allocator can change
ERR_ALLOC_FAILED;
......@@ -261,7 +261,7 @@ static void knot_free_changeset(knot_changeset_t *changeset)
}
// Delete RRSets in lists, in case there are any left
knot_rr_node_t *rr_node;
knot_rr_ln_t *rr_node;
WALK_LIST(rr_node, changeset->add) {
knot_rrset_deep_free(&rr_node->rr, 1, 1);
}
......
......@@ -58,17 +58,17 @@ typedef struct knot_changeset {
/*----------------------------------------------------------------------------*/
/*! \brief Wrapper for oh-so-great BIRD lists. Storing: RRSet. */
typedef struct knot_rr_node {
/*! \brief Wrapper BIRD lists. Storing: RRSet. */
typedef struct knot_rr_ln {
node n; /*!< List node. */
knot_rrset_t *rr; /*!< Actual usable data. */
} knot_rr_node_t;
} knot_rr_ln_t;
/*! \brief Wrapper for oh-so-great BIRD lists. Storing: Node. */
typedef struct knot_node_list {
/*! \brief Wrapper BIRD lists. Storing: Node. */
typedef struct knot_node_ln {
node n; /*!< List node. */
knot_node_t *node; /*!< Actual usable data. */
} knot_node_list_t;
} knot_node_ln_t;
/*! \brief Partial changes done to zones - used for update/transfer rollback. */
typedef struct {
......
......@@ -193,7 +193,7 @@ static int knot_ddns_check_remove_rr(knot_changeset_t *changeset,
const knot_rrset_t *rr)
{
dbg_ddns_verb("Removing possible redundant RRs from changeset.\n");
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
node *nxt = NULL;
WALK_LIST_DELSAFE(rr_node, nxt, changeset->add) {
// Removing RR(s) from this owner
......@@ -812,7 +812,7 @@ static int knot_ddns_check_remove_rr2(knot_changeset_t *changeset,
*/
dbg_ddns_verb("Removing possible redundant RRs from changeset.\n");
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
node *nxt = NULL;
WALK_LIST_DELSAFE(rr_node, nxt, changeset->add) {
knot_rrset_t *rrset = rr_node->rr;
......@@ -865,7 +865,7 @@ static void knot_ddns_check_add_rr(knot_changeset_t *changeset,
*removed = NULL;
dbg_ddns_verb("Removing possible redundant RRs from changeset.\n");
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
node *nxt = NULL;
WALK_LIST_DELSAFE(rr_node, nxt, changeset->remove) {
knot_rrset_t *rrset = rr_node->rr;
......
......@@ -2216,14 +2216,14 @@ dbg_xfrin_exec_detail(
void xfrin_cleanup_successful_update(knot_changes_t *changes)
{
// Free old RRSets
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
WALK_LIST(rr_node, changes->old_rrsets) {
knot_rrset_t *rrset = rr_node->rr;
knot_rrset_deep_free_no_sig(&rrset, 1, 1);
}
// Free old nodes
knot_node_list_t *n_node = NULL;
knot_node_ln_t *n_node = NULL;
WALK_LIST(n_node, changes->old_nodes) {
knot_node_free(&n_node->node);
}
......@@ -2332,7 +2332,7 @@ void xfrin_rollback_update(knot_zone_contents_t *old_contents,
}
dbg_xfrin("Rolling back changeset application.\n");
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
WALK_LIST(rr_node, changes->new_rrsets) {
knot_rrset_t *rrset = rr_node->rr;
knot_rrset_deep_free_no_sig(&rrset, 1, 1);
......@@ -2358,7 +2358,7 @@ static int xfrin_apply_remove(knot_zone_contents_t *contents,
knot_rrset_t *rrsigs = NULL;
int is_nsec3 = 0;
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
WALK_LIST(rr_node, chset->remove) {
knot_rrset_t *rr = rr_node->rr;
assert(rr); // No malformed changesets should get here
......@@ -2452,7 +2452,7 @@ static int xfrin_apply_add(knot_zone_contents_t *contents,
knot_rrset_t *rrsigs = NULL;
int is_nsec3 = 0;
knot_rr_node_t *rr_node = NULL;
knot_rr_ln_t *rr_node = NULL;
node *tmp_node;
WALK_LIST_DELSAFE(rr_node, tmp_node, chset->add) {
knot_rrset_t *rr = rr_node->rr;
......@@ -2698,7 +2698,7 @@ static int xfrin_remove_empty_nodes(knot_zone_contents_t *contents,
// Remove these nodes from zone tree.
knot_node_t *zone_node = NULL;
knot_node_list_t *list_node = NULL;
knot_node_ln_t *list_node = NULL;
WALK_LIST(list_node, changes->old_nodes) {
knot_node_t *node = list_node->node;
assert(node);
......
......@@ -981,7 +981,7 @@ static void knot_zone_diff_dump_changeset(knot_changeset_t *ch)
dbg_zonediff_detail("ADD section:\n");
dbg_zonediff_detail("**********************************************\n");
knot_rr_node_t *rr_node;
knot_rr_ln_t *rr_node;
WALK_LIST(rr_node, ch->add) {
knot_rrset_dump(rr_node->rr);
dbg_zonediff_detail("\n");
......
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