Commit 1d058c41 authored by Daniel Salzman's avatar Daniel Salzman

hat-trie: remove hattrie_build_index as qp-trie doesn't need it

parent 8147eafa
......@@ -45,12 +45,6 @@ inline static size_t hattrie_weight(const hattrie_t *trie)
return qp_trie_weight(trie);
}
inline static void hattrie_build_index(hattrie_t *trie)
{
// not needed
UNUSED(trie);
}
inline static int hattrie_apply_rev(hattrie_t *trie, int (*f)(value_t*,void*), void* d)
{
return qp_trie_apply(trie, f, d);
......
......@@ -469,9 +469,6 @@ static int create_nsec3_nodes(const zone_contents_t *zone,
hattrie_iter_free(it);
/* Rebuild index over nsec3 nodes. */
hattrie_build_index(nsec3_nodes);
return result;
}
......
......@@ -77,9 +77,6 @@ static int changeset_iter_init(changeset_iter_t *ch_it,
for (size_t i = 0; i < tries; ++i) {
hattrie_t *t = va_arg(args, hattrie_t *);
if (t) {
if (sorted) {
hattrie_build_index(t);
}
hattrie_iter_t *it = hattrie_iter_begin(t, sorted);
if (it == NULL) {
cleanup_iter_list(&ch_it->iters);
......
......@@ -643,7 +643,6 @@ 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. */
tree = nsec3 ? _contents->nsec3_nodes : _contents->nodes;
hattrie_build_index(tree);
it->tree_it = hattrie_iter_begin(nsec3 ? _contents->nsec3_nodes : _contents->nodes, true);
if (it->tree_it == NULL) {
return KNOT_ENOMEM;
......
......@@ -700,7 +700,6 @@ static int recreate_normal_tree(const zone_contents_t *z, zone_contents_t *out)
}
hattrie_iter_free(itt);
hattrie_build_index(out->nodes);
return KNOT_EOK;
}
......@@ -735,7 +734,6 @@ static int recreate_nsec3_tree(const zone_contents_t *z, zone_contents_t *out)
}
hattrie_iter_free(itt);
hattrie_build_index(out->nsec3_nodes);
return KNOT_EOK;
}
......@@ -952,7 +950,6 @@ static int adjust_nodes(zone_tree_t *nodes, zone_adjust_arg_t *adjust_arg,
adjust_arg->first_node = NULL;
adjust_arg->previous_node = NULL;
hattrie_build_index(nodes);
int ret = zone_tree_apply(nodes, callback, adjust_arg);
if (adjust_arg->first_node) {
......
......@@ -54,12 +54,6 @@ static int txn_begin(knot_db_t *db, knot_db_txn_t *txn, unsigned flags)
static int txn_commit(knot_db_txn_t *txn)
{
/* Rebuild order index only for WR transactions. */
if ((size_t)txn->txn & KNOT_DB_RDONLY) {
return KNOT_EOK;
}
hattrie_build_index((hattrie_t *)txn->db);
return KNOT_EOK;
}
......
......@@ -89,15 +89,6 @@ int lookup_insert(lookup_t *lookup, const char *str, void *data)
return KNOT_EOK;
}
void lookup_index(lookup_t *lookup)
{
if (lookup == NULL) {
return;
}
hattrie_build_index(lookup->trie);
}
static int set_key(lookup_t *lookup, char **dst, const char *key, size_t key_len)
{
if (*dst != NULL) {
......
......@@ -82,13 +82,6 @@ void lookup_deinit(lookup_t *lookup);
*/
int lookup_insert(lookup_t *lookup, const char *str, void *data);
/*!
* Indexes the lookup container.
*
* \param[in] lookup Lookup context.
*/
void lookup_index(lookup_t *lookup);
/*!
* Searches the lookup container for the given key.
*
......
......@@ -44,7 +44,6 @@ static void cmds_lookup(EditLine *el, const char *str, size_t str_len)
}
}
lookup_index(&lookup);
lookup_complete(&lookup, str, str_len, el, true);
cmds_lookup_finish:
......@@ -73,7 +72,6 @@ static void local_zones_lookup(EditLine *el, const char *str, size_t str_len)
}
}
lookup_index(&lookup);
lookup_complete(&lookup, str, str_len, el, true);
local_zones_lookup_finish:
......@@ -173,7 +171,6 @@ static void id_lookup(EditLine *el, const char *str, size_t str_len,
}
}
lookup_index(&lookup);
lookup_complete(&lookup, str, str_len, el, add_space);
id_lookup_finish:
......@@ -229,7 +226,6 @@ static void list_lookup(EditLine *el, const char *section, const char *item)
}
}
lookup_index(&lookup);
lookup_complete(&lookup, item, strlen(item), el, section != NULL);
list_lookup_finish:
......
......@@ -139,9 +139,6 @@ int main(int argc, char *argv[])
/* Check total insertions against trie weight. */
is_int(hattrie_weight(trie), inserted, "hattrie: trie weight matches insertions");
/* Build order-index. */
hattrie_build_index(trie);
/* Lookup all keys */
passed = true;
for (unsigned i = 0; i < key_count; ++i) {
......
......@@ -63,8 +63,6 @@ static void init(lookup_t *l, const char **table)
ok(ret == KNOT_EOK, "Insert '%s'", *table);
table++;
}
lookup_index(l);
}
static void test_search_basic(void)
......
......@@ -98,9 +98,6 @@ int main(int argc, char *argv[])
}
ok(passed, "ztree: lookup");
/* heal index for ordered lookup */
hattrie_build_index(t);
/* 4. ordered lookup */
node = NULL;
zone_node_t *prev = NULL;
......
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