Commit 307ad5a7 authored by Daniel Salzman's avatar Daniel Salzman

contrib: remove hat-trie wrapper for qp-trie

parent c9fba95f
......@@ -30,7 +30,6 @@ src/contrib/fnv/hash_64a.c
src/contrib/fnv/longlong.h
src/contrib/getline.c
src/contrib/getline.h
src/contrib/hat-trie/hat-trie.h
src/contrib/hhash.c
src/contrib/hhash.h
src/contrib/lmdb/lmdb.h
......@@ -50,8 +49,8 @@ src/contrib/openbsd/strlcpy.c
src/contrib/openbsd/strlcpy.h
src/contrib/print.c
src/contrib/print.h
src/contrib/qp-trie/qp.c
src/contrib/qp-trie/qp.h
src/contrib/qp-trie/trie.c
src/contrib/qp-trie/trie.h
src/contrib/sockaddr.c
src/contrib/sockaddr.h
src/contrib/string.c
......
......@@ -49,7 +49,6 @@ libcontrib_la_SOURCES = \
contrib/fnv/longlong.h \
contrib/getline.c \
contrib/getline.h \
contrib/hat-trie/hat-trie.h \
contrib/hhash.c \
contrib/hhash.h \
contrib/macros.h \
......@@ -59,8 +58,8 @@ libcontrib_la_SOURCES = \
contrib/net.h \
contrib/print.c \
contrib/print.h \
contrib/qp-trie/qp.c \
contrib/qp-trie/qp.h \
contrib/qp-trie/trie.c \
contrib/qp-trie/trie.h \
contrib/sockaddr.c \
contrib/sockaddr.h \
contrib/string.c \
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "contrib/qp-trie/qp.h"
#include "contrib/hhash.h"
typedef trie_t hattrie_t;
typedef trie_it_t hattrie_iter_t;
inline static hattrie_t* hattrie_create(struct knot_mm *mm)
{
return trie_create(mm);
}
inline static void hattrie_free(hattrie_t *trie)
{
trie_free(trie);
}
inline static void hattrie_clear(hattrie_t *trie)
{
trie_clear(trie);
}
inline static size_t hattrie_weight(const hattrie_t *trie)
{
return trie_weight(trie);
}
inline static int hattrie_apply_rev(hattrie_t *trie, int (*f)(value_t*,void*), void* d)
{
return trie_apply(trie, f, d);
}
inline static value_t* hattrie_tryget(hattrie_t *trie, const char *key, size_t len)
{
return trie_get_try(trie, key, len);
}
inline static value_t* hattrie_get(hattrie_t *trie, const char *key, size_t len)
{
return trie_get_ins(trie, key, len);
}
inline static int hattrie_find_leq(hattrie_t *trie, const char *key, size_t len, value_t **dst)
{
return trie_get_leq(trie, key, len, dst);
}
inline static int hattrie_del(hattrie_t *trie, const char* key, size_t len, value_t *val)
{
return trie_del(trie, key, len, val);
}
inline static hattrie_iter_t* hattrie_iter_begin(hattrie_t *trie)
{
return trie_it_begin(trie);
}
inline static void hattrie_iter_next(hattrie_iter_t *it)
{
trie_it_next(it);
}
inline static bool hattrie_iter_finished(hattrie_iter_t *it)
{
return trie_it_finished(it);
}
inline static void hattrie_iter_free(hattrie_iter_t *it)
{
trie_it_free(it);
}
inline static const char* hattrie_iter_key(hattrie_iter_t *it, size_t *len)
{
return trie_it_key(it, len);
}
inline static value_t* hattrie_iter_val(hattrie_iter_t *it)
{
return trie_it_val(it);
}
......@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include "contrib/qp-trie/qp.h"
#include "contrib/qp-trie/trie.h"
#include "contrib/macros.h"
#include "contrib/mempattern.h"
#include "libknot/errcode.h"
......
......@@ -360,7 +360,7 @@ void conf_free(
conf->api->txn_abort(conf->io.txn_stack);
}
if (conf->io.zones != NULL) {
hattrie_free(conf->io.zones);
trie_free(conf->io.zones);
mm_free(conf->mm, conf->io.zones);
}
......
......@@ -27,7 +27,7 @@
#include "libknot/libknot.h"
#include "libknot/yparser/ypscheme.h"
#include "contrib/hat-trie/hat-trie.h"
#include "contrib/qp-trie/trie.h"
#include "contrib/ucw/lists.h"
/*! Default template identifier. */
......@@ -91,7 +91,7 @@ typedef struct {
/*! Master transaction flags. */
yp_flag_t flags;
/*! Changed zones. */
hattrie_t *zones;
trie_t *zones;
} io;
/*! Current config file (for reload if started with config file). */
......
......@@ -83,7 +83,7 @@ int conf_io_begin(
if (!child) {
conf()->io.flags = CONF_IO_FACTIVE;
if (conf()->io.zones != NULL) {
hattrie_clear(conf()->io.zones);
trie_clear(conf()->io.zones);
}
}
......@@ -130,7 +130,7 @@ void conf_io_abort(
if (!child) {
conf()->io.flags = YP_FNONE;
if (conf()->io.zones != NULL) {
hattrie_clear(conf()->io.zones);
trie_clear(conf()->io.zones);
}
}
}
......@@ -442,18 +442,18 @@ static int diff_zone_section(
return KNOT_EOK;
}
hattrie_iter_t *it = hattrie_iter_begin(conf()->io.zones);
for (; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
io->id = (const uint8_t *)hattrie_iter_key(it, &io->id_len);
trie_it_t *it = trie_it_begin(conf()->io.zones);
for (; !trie_it_finished(it); trie_it_next(it)) {
io->id = (const uint8_t *)trie_it_key(it, &io->id_len);
// Get the difference for specific zone.
int ret = diff_section(io);
if (ret != KNOT_EOK) {
hattrie_iter_free(it);
trie_it_free(it);
return ret;
}
}
hattrie_iter_free(it);
trie_it_free(it);
return KNOT_EOK;
}
......@@ -818,9 +818,9 @@ static void upd_changes(
}
// Prepare zone changes storage if it doesn't exist.
hattrie_t *zones = conf()->io.zones;
trie_t *zones = conf()->io.zones;
if (zones == NULL) {
zones = hattrie_create(conf()->mm);
zones = trie_create(conf()->mm);
if (zones == NULL) {
return;
}
......@@ -828,7 +828,7 @@ static void upd_changes(
}
// Get zone status or create new.
value_t *val = hattrie_get(zones, (const char *)io->id, io->id_len);
trie_val_t *val = trie_get_ins(zones, (const char *)io->id, io->id_len);
conf_io_type_t *current = (conf_io_type_t *)val;
switch (type) {
......@@ -846,7 +846,7 @@ static void upd_changes(
case CONF_IO_TUNSET:
if (*current & CONF_IO_TSET) {
// Remove inserted zone -> no change.
hattrie_del(zones, (const char *)io->id, io->id_len, NULL);
trie_del(zones, (const char *)io->id, io->id_len, NULL);
} else {
// Remove existing zone.
*current |= type;
......@@ -1399,12 +1399,12 @@ static int check_zone_section(
return KNOT_EOK;
}
hattrie_iter_t *it = hattrie_iter_begin(conf()->io.zones);
for (; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
trie_it_t *it = trie_it_begin(conf()->io.zones);
for (; !trie_it_finished(it); trie_it_next(it)) {
size_t id_len;
const uint8_t *id = (const uint8_t *)hattrie_iter_key(it, &id_len);
const uint8_t *id = (const uint8_t *)trie_it_key(it, &id_len);
conf_io_type_t type = (conf_io_type_t)(*hattrie_iter_val(it));
conf_io_type_t type = (conf_io_type_t)(*trie_it_val(it));
if (type == CONF_IO_TUNSET) {
// Nothing to check.
continue;
......@@ -1413,11 +1413,11 @@ static int check_zone_section(
// Check specific zone.
int ret = check_section(item, id, id_len, io);
if (ret != KNOT_EOK) {
hattrie_iter_free(it);
trie_it_free(it);
return ret;
}
}
hattrie_iter_free(it);
trie_it_free(it);
return KNOT_EOK;
}
......
......@@ -162,25 +162,25 @@ int knot_nsec_chain_iterate_create(zone_tree_t *nodes,
assert(nodes);
assert(callback);
hattrie_iter_t *it = hattrie_iter_begin(nodes);
trie_it_t *it = trie_it_begin(nodes);
if (!it) {
return KNOT_ENOMEM;
}
if (hattrie_iter_finished(it)) {
hattrie_iter_free(it);
if (trie_it_finished(it)) {
trie_it_free(it);
return KNOT_EINVAL;
}
zone_node_t *first = (zone_node_t *)*hattrie_iter_val(it);
zone_node_t *first = (zone_node_t *)*trie_it_val(it);
zone_node_t *previous = first;
zone_node_t *current = first;
hattrie_iter_next(it);
trie_it_next(it);
int result = KNOT_EOK;
while (!hattrie_iter_finished(it)) {
current = (zone_node_t *)*hattrie_iter_val(it);
while (!trie_it_finished(it)) {
current = (zone_node_t *)*trie_it_val(it);
result = callback(previous, current, data);
if (result == NSEC_NODE_SKIP) {
......@@ -189,13 +189,13 @@ int knot_nsec_chain_iterate_create(zone_tree_t *nodes,
} else if (result == KNOT_EOK) {
previous = current;
} else {
hattrie_iter_free(it);
trie_it_free(it);
return result;
}
hattrie_iter_next(it);
trie_it_next(it);
}
hattrie_iter_free(it);
trie_it_free(it);
return result == NSEC_NODE_SKIP ? callback(previous, first, data) :
callback(current, first, data);
......
......@@ -120,10 +120,10 @@ static int copy_signatures(zone_tree_t *from, zone_tree_t *to)
assert(to);
hattrie_iter_t *it = hattrie_iter_begin(from);
trie_it_t *it = trie_it_begin(from);
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
zone_node_t *node_from = (zone_node_t *)*hattrie_iter_val(it);
for (/* NOP */; !trie_it_finished(it); trie_it_next(it)) {
zone_node_t *node_from = (zone_node_t *)*trie_it_val(it);
zone_node_t *node_to = NULL;
zone_tree_get(to, node_from->owner, &node_to);
......@@ -137,12 +137,12 @@ static int copy_signatures(zone_tree_t *from, zone_tree_t *to)
int ret = shallow_copy_signature(node_from, node_to);
if (ret != KNOT_EOK) {
hattrie_iter_free(it);
trie_it_free(it);
return ret;
}
}
hattrie_iter_free(it);
trie_it_free(it);
return KNOT_EOK;
}
......@@ -154,9 +154,9 @@ static void free_nsec3_tree(zone_tree_t *nodes)
{
assert(nodes);
hattrie_iter_t *it = hattrie_iter_begin(nodes);
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
zone_node_t *node = (zone_node_t *)*hattrie_iter_val(it);
trie_it_t *it = trie_it_begin(nodes);
for (/* NOP */; !trie_it_finished(it); trie_it_next(it)) {
zone_node_t *node = (zone_node_t *)*trie_it_val(it);
// newly allocated NSEC3 nodes
knot_rdataset_t *nsec3 = node_rdataset(node, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *rrsig = node_rdataset(node, KNOT_RRTYPE_RRSIG);
......@@ -165,7 +165,7 @@ static void free_nsec3_tree(zone_tree_t *nodes)
node_free(&node, NULL);
}
hattrie_iter_free(it);
trie_it_free(it);
zone_tree_free(&nodes);
}
......@@ -428,9 +428,9 @@ static int create_nsec3_nodes(const zone_contents_t *zone,
int result = KNOT_EOK;
hattrie_iter_t *it = hattrie_iter_begin(zone->nodes);
while (!hattrie_iter_finished(it)) {
zone_node_t *node = (zone_node_t *)*hattrie_iter_val(it);
trie_it_t *it = trie_it_begin(zone->nodes);
while (!trie_it_finished(it)) {
zone_node_t *node = (zone_node_t *)*trie_it_val(it);
/*!
* Remove possible NSEC from the node. (Do not allow both NSEC
......@@ -444,7 +444,7 @@ static int create_nsec3_nodes(const zone_contents_t *zone,
node->flags |= NODE_FLAGS_REMOVED_NSEC;
}
if (node->flags & NODE_FLAGS_NONAUTH || node->flags & NODE_FLAGS_EMPTY) {
hattrie_iter_next(it);
trie_it_next(it);
continue;
}
......@@ -461,10 +461,10 @@ static int create_nsec3_nodes(const zone_contents_t *zone,
break;
}
hattrie_iter_next(it);
trie_it_next(it);
}
hattrie_iter_free(it);
trie_it_free(it);
return result;
}
......
......@@ -615,7 +615,7 @@ typedef struct {
const zone_keyset_t *zone_keys;
const kdnssec_ctx_t *dnssec_ctx;
changeset_t *changeset;
hattrie_t *signed_tree;
trie_t *signed_tree;
} changeset_signing_data_t;
/*- private API - DNSKEY handling --------------------------------------------*/
......@@ -978,7 +978,7 @@ static int add_rr_type_to_list(const knot_rrset_t *rr, list_t *l)
*
* \return KNOT_E*
*/
static int rr_already_signed(const knot_rrset_t *rrset, hattrie_t *t,
static int rr_already_signed(const knot_rrset_t *rrset, trie_t *t,
bool *rr_signed)
{
assert(rrset);
......@@ -987,7 +987,7 @@ static int rr_already_signed(const knot_rrset_t *rrset, hattrie_t *t,
// Create a key = RRSet owner converted to sortable format
uint8_t lf[KNOT_DNAME_MAXLEN];
knot_dname_lf(lf, rrset->owner, NULL);
value_t stored_info = (signed_info_t *)hattrie_tryget(t, (char *)lf+1,
trie_val_t stored_info = (signed_info_t *)trie_get_try(t, (char *)lf+1,
*lf);
if (stored_info == NULL) {
// Create new info struct
......@@ -1018,7 +1018,7 @@ static int rr_already_signed(const knot_rrset_t *rrset, hattrie_t *t,
free(info);
return ret;
}
*hattrie_get(t, (char *)lf+1, *lf) = info;
*trie_get_ins(t, (char *)lf+1, *lf) = info;
} else {
signed_info_t *info = *((signed_info_t **)stored_info);
assert(info->type_list);
......@@ -1107,7 +1107,7 @@ static int sign_changeset_wrap(knot_rrset_t *chg_rrset, changeset_signing_data_t
* \param val Node to free.
* \param d Unused.
*/
static int free_helper_trie_node(value_t *val, void *d)
static int free_helper_trie_node(trie_val_t *val, void *d)
{
UNUSED(d);
signed_info_t *info = (signed_info_t *)*val;
......@@ -1126,10 +1126,10 @@ static int free_helper_trie_node(value_t *val, void *d)
*
* \param t Trie to clear.
*/
static void knot_zone_clear_sorted_changes(hattrie_t *t)
static void knot_zone_clear_sorted_changes(trie_t *t)
{
if (t) {
hattrie_apply_rev(t, free_helper_trie_node, NULL);
trie_apply(t, free_helper_trie_node, NULL);
}
}
......@@ -1257,13 +1257,13 @@ int knot_zone_sign_changeset(const zone_contents_t *zone,
return KNOT_EINVAL;
}
// Create args for wrapper function - hattrie for duplicate sigs
// Create args for wrapper function - trie for duplicate sigs
changeset_signing_data_t args = {
.zone = zone,
.zone_keys = zone_keys,
.dnssec_ctx = dnssec_ctx,
.changeset = out_ch,
.signed_tree = hattrie_create(NULL)
.signed_tree = trie_create(NULL)
};
if (args.signed_tree == NULL) {
......@@ -1285,7 +1285,7 @@ int knot_zone_sign_changeset(const zone_contents_t *zone,
changeset_iter_clear(&itt);
knot_zone_clear_sorted_changes(args.signed_tree);
hattrie_free(args.signed_tree);
trie_free(args.signed_tree);
return KNOT_EOK;
}
......
......@@ -37,7 +37,7 @@
/* AXFR context. @note aliasing the generic xfr_proc */
struct axfr_proc {
struct xfr_proc proc;
hattrie_iter_t *i;
trie_it_t *i;
unsigned cur_rrset;
};
......@@ -78,24 +78,24 @@ static int axfr_process_node_tree(knot_pkt_t *pkt, const void *item,
struct axfr_proc *axfr = (struct axfr_proc*)state;
if (axfr->i == NULL) {
axfr->i = hattrie_iter_begin((hattrie_t *)item);
axfr->i = trie_it_begin((trie_t *)item);
}
/* Put responses. */
int ret = KNOT_EOK;
zone_node_t *node = NULL;
while (!hattrie_iter_finished(axfr->i)) {
node = (zone_node_t *)*hattrie_iter_val(axfr->i);
while (!trie_it_finished(axfr->i)) {
node = (zone_node_t *)*trie_it_val(axfr->i);
ret = axfr_put_rrsets(pkt, node, axfr);
if (ret != KNOT_EOK) {
break;
}
hattrie_iter_next(axfr->i);
trie_it_next(axfr->i);
}
/* Finished all nodes. */
if (ret == KNOT_EOK) {
hattrie_iter_free(axfr->i);
trie_it_free(axfr->i);
axfr->i = NULL;
}
return ret;
......@@ -105,7 +105,7 @@ static void axfr_query_cleanup(struct query_data *qdata)
{
struct axfr_proc *axfr = (struct axfr_proc *)qdata->ext;
hattrie_iter_free(axfr->i);
trie_it_free(axfr->i);
ptrlist_free(&axfr->proc.nodes, qdata->mm);
mm_free(qdata->mm, axfr);
......
......@@ -616,7 +616,7 @@ int server_reload(server_t *server)
// Reset confio reload context.
conf()->io.flags = YP_FNONE;
if (conf()->io.zones != NULL) {
hattrie_clear(conf()->io.zones);
trie_clear(conf()->io.zones);
}
}
......
......@@ -54,8 +54,8 @@ static void cleanup_iter_list(list_t *l)
{
ptrnode_t *n, *nxt;
WALK_LIST_DELSAFE(n, nxt, *l) {
hattrie_iter_t *it = (hattrie_iter_t *)n->d;
hattrie_iter_free(it);
trie_it_t *it = (trie_it_t *)n->d;
trie_it_free(it);
rem_node(&n->n);
free(n);
}
......@@ -72,12 +72,12 @@ static int changeset_iter_init(changeset_iter_t *ch_it, size_t tries, ...)
va_start(args, tries);
for (size_t i = 0; i < tries; ++i) {
hattrie_t *t = va_arg(args, hattrie_t *);
trie_t *t = va_arg(args, trie_t *);
if (t == NULL) {
continue;
}
hattrie_iter_t *it = hattrie_iter_begin(t);
trie_it_t *it = trie_it_begin(t);
if (it == NULL) {
cleanup_iter_list(&ch_it->iters);
va_end(args);
......@@ -97,27 +97,27 @@ static int changeset_iter_init(changeset_iter_t *ch_it, size_t tries, ...)
}
/*! \brief Gets next node from trie iterators. */
static void iter_next_node(changeset_iter_t *ch_it, hattrie_iter_t *t_it)
static void iter_next_node(changeset_iter_t *ch_it, trie_it_t *t_it)
{
assert(!hattrie_iter_finished(t_it));
assert(!trie_it_finished(t_it));
// Get next node, but not for the very first call.
if (ch_it->node) {
hattrie_iter_next(t_it);
trie_it_next(t_it);
}
if (hattrie_iter_finished(t_it)) {
if (trie_it_finished(t_it)) {
ch_it->node = NULL;
return;
}
ch_it->node = (zone_node_t *)*hattrie_iter_val(t_it);
ch_it->node = (zone_node_t *)*trie_it_val(t_it);
assert(ch_it->node);
while (ch_it->node && ch_it->node->rrset_count == 0) {
// Skip empty non-terminals.
hattrie_iter_next(t_it);
if (hattrie_iter_finished(t_it)) {
trie_it_next(t_it);
if (trie_it_finished(t_it)) {
ch_it->node = NULL;
} else {
ch_it->node = (zone_node_t *)*hattrie_iter_val(t_it);
ch_it->node = (zone_node_t *)*trie_it_val(t_it);
assert(ch_it->node);
}
}
......@@ -126,12 +126,12 @@ static void iter_next_node(changeset_iter_t *ch_it, hattrie_iter_t *t_it)
}
/*! \brief Gets next RRSet from trie iterators. */
static knot_rrset_t get_next_rr(changeset_iter_t *ch_it, hattrie_iter_t *t_it)
static knot_rrset_t get_next_rr(changeset_iter_t *ch_it, trie_it_t *t_it)
{
if (ch_it->node == NULL || ch_it->node_pos == ch_it->node->rrset_count) {
iter_next_node(ch_it, t_it);
if (ch_it->node == NULL) {
assert(hattrie_iter_finished(t_it));
assert(trie_it_finished(t_it));
knot_rrset_t rr;
knot_rrset_init_empty(&rr);
return rr;
......@@ -458,8 +458,8 @@ knot_rrset_t changeset_iter_next(changeset_iter_t *it)
knot_rrset_t rr;
knot_rrset_init_empty(&rr);
WALK_LIST(n, it->iters) {
hattrie_iter_t *t_it = (hattrie_iter_t *)n->d;
if (hattrie_iter_finished(t_it)) {
trie_it_t *t_it = (trie_it_t *)n->d;
if (trie_it_finished(t_it)) {
continue;
}
......
......@@ -634,27 +634,27 @@ static int iter_init_tree_iters(zone_update_iter_t *it, zone_update_t *update,
/* Begin iteration. We can safely assume _contents is a valid pointer. */
zone_tree_t *tree = nsec3 ? _contents->nsec3_nodes : _contents->nodes;
it->tree_it = hattrie_iter_begin(tree);
it->tree_it = trie_it_begin(tree);
if (it->tree_it == NULL) {
return KNOT_ENOMEM;
}
it->cur_node = (zone_node_t *)(*hattrie_iter_val(it->tree_it));
it->cur_node = (zone_node_t *)(*trie_it_val(it->tree_it));
return KNOT_EOK;
}
static int iter_get_next_node(zone_update_iter_t *it)
{
hattrie_iter_next(it->tree_it);
if (hattrie_iter_finished(it->tree_it)) {
hattrie_iter_free(it->tree_it);
trie_it_next(it->tree_it);
if (trie_it_finished(it->tree_it)) {
trie_it_free(it->tree_it);
it->tree_it = NULL;
it->cur_node = NULL;
return KNOT_ENOENT;
}
it->cur_node = (zone_node_t *)(*hattrie_iter_val(it->tree_it));
it->cur_node = (zone_node_t *)(*trie_it_val(it->tree_it));
return KNOT_EOK;
}
......@@ -670,7 +670,7 @@ static int iter_init(zone_update_iter_t *it, zone_update_t *update, const bool n
return ret;
}
it->cur_node = (zone_node_t *)(*hattrie_iter_val(it->tree_it));
it->cur_node = (zone_node_t *)(*trie_it_val(it->tree_it));
return KNOT_EOK;
}
......@@ -737,7 +737,7 @@ void zone_update_iter_finish(zone_update_iter_t *it)
return;
}
hattrie_iter_free(it->tree_it);
trie_it_free(it->tree_it);
}
bool zone_update_no_change(zone_update_t *update)
......
......@@ -43,7 +43,7 @@ typedef struct zone_update {
typedef struct {
zone_update_t *update; /*!< The update we're iterating over. */
hattrie_iter_t *tree_it; /*!< Iterator for the new zone. */
trie_it_t *tree_it; /*!< Iterator for the new zone. */
const zone_node_t *cur_node; /*!< Current node in the new zone. */
bool nsec3; /*!< Set when we're using the NSEC3 node tree. */
} zone_update_iter_t;
......
......@@ -21,7 +21,7 @@
#include "knot/common/log.h"
#include "knot/dnssec/zone-nsec.h"
#include "libknot/libknot.h"
#include "contrib/hat-trie/hat-trie.h"
#include "contrib/qp-trie/trie.h"
#include "contrib/macros.h"
typedef struct {
......@@ -652,7 +652,7 @@ static int remove_rr(zone_contents_t *z, const knot_rrset_t *rr,
static int recreate_normal_tree(const zone_contents_t *z, zone_contents_t *out)
{
out->nodes = hattrie_create(NULL);
out->nodes = trie_create(NULL);
if (out->nodes == NULL) {
return KNOT_ENOMEM;
}
......@@ -672,68 +672,68 @@ static int recreate_normal_tree(const zone_contents_t *z, zone_contents_t *out)
out->apex = apex_cpy;
hattrie_iter_t *itt = hattrie_iter_begin(z->nodes);
trie_it_t *itt = trie_it_begin(z->nodes);
if (itt == NULL) {
return KNOT_ENOMEM;
}
while (!hattrie_iter_finished(itt)) {
const zone_node_t *to_cpy = (zone_node_t *)*hattrie_iter_val(itt);