diff --git a/src/common/evqueue.c b/src/common/evqueue.c index e70998b3953f1d6ac8a5c3171fb9a54034b145bf..54f1f6da0e2d53e7374bab65eb53ce1eca243b9d 100644 --- a/src/common/evqueue.c +++ b/src/common/evqueue.c @@ -37,11 +37,6 @@ void evqueue_free(evqueue_t **q) free(eq); } -int evqueue_pollfd(evqueue_t *q) -{ - return q->fds[EVQUEUE_READFD]; -} - int evqueue_poll(evqueue_t *q, const struct timespec *ts, const sigset_t *sigmask) { diff --git a/src/common/evqueue.h b/src/common/evqueue.h index c5d9205448aaeee38a1ec330b3046bead8447ff1..d5eed9d0b931384248cbbdc9107473dce0dc1cc3 100644 --- a/src/common/evqueue.h +++ b/src/common/evqueue.h @@ -83,16 +83,6 @@ evqueue_t *evqueue_new(); */ void evqueue_free(evqueue_t **q); -/*! - * \brief Return evqueue pollable fd. - * - * \param q Event queue. - * - * \retval File descriptor available for polling. - * \retval -1 On error. - */ -int evqueue_pollfd(evqueue_t *q); - /*! * \brief Poll for new events. * diff --git a/src/dnslib/dname.c b/src/dnslib/dname.c index e0edd8a0920313d7db40e2da5f08f2dc52dfc2a1..fb51b80d1d42914f41163ed9cdccbd1846b77eb4 100644 --- a/src/dnslib/dname.c +++ b/src/dnslib/dname.c @@ -680,13 +680,6 @@ void dnslib_dname_update_node(dnslib_dname_t *dname) /*----------------------------------------------------------------------------*/ -void dnslib_dname_set_node(dnslib_dname_t *dname, dnslib_node_t *node) -{ - dname->node = node; -} - -/*----------------------------------------------------------------------------*/ - int dnslib_dname_is_fqdn(const dnslib_dname_t *dname) { return (dname->name[dname->size - 1] == '\0'); diff --git a/src/dnslib/tests/dnslib/zone_tests.c b/src/dnslib/tests/dnslib/zone_tests.c index 8c04567eebe0c26c9ce6de279540245489d8c6f8..cf86c09077c56db2abd5fdcfb0dcdcef21dff522 100644 --- a/src/dnslib/tests/dnslib/zone_tests.c +++ b/src/dnslib/tests/dnslib/zone_tests.c @@ -485,11 +485,11 @@ static void tree_node_to_array(dnslib_node_t *node, void *data) param->dnslib_node_array[param->count++] = node; } -static void tree_dname_node_to_array(struct dname_table_node *node, +static void tree_dname_node_to_array(dnslib_dname_t *node, void *data) { struct zone_test_param *param = (struct zone_test_param *)data; - param->table_node_array[param->count++] = node->dname; + param->table_node_array[param->count++] = node; } extern int compare_wires_simple(uint8_t *w1, uint8_t *w2, uint count); @@ -502,56 +502,59 @@ static int test_zone_shallow_copy() strlen("a.ns.nic.cz"), NULL); assert(apex_dname); dnslib_node_t *apex_node = - dnslib_node_new(apex_dname, NULL); + dnslib_node_new(apex_dname, NULL, 0); assert(apex_node); lives_ok({ - if (dnslib_zone_shallow_copy(NULL, NULL) != DNSLIB_EBADARG) { + if (dnslib_zone_contents_shallow_copy(NULL, NULL) != DNSLIB_EBADARG) { diag("Calling zone_shallow_copy with NULL " "arguments did not return DNSLIB_EBADARG!"); errors++; } lived = 1; lived = 0; - dnslib_zone_t *zone = dnslib_zone_new(apex_node, 0, 1); - if (dnslib_zone_shallow_copy(zone, NULL) != DNSLIB_EBADARG) { + dnslib_zone_contents_t *zone = dnslib_zone_contents_new(apex_node, + 0, 1, 0); + if (dnslib_zone_contents_shallow_copy(zone, NULL) != DNSLIB_EBADARG) { diag("Calling zone_shallow_copy with NULL destination " "zone argument did not return DNSLIB_EBADARG!"); errors++; } lived = 1; lived = 0; - if (dnslib_zone_shallow_copy(NULL, &zone) != DNSLIB_EBADARG) { + if (dnslib_zone_contents_shallow_copy(NULL, &zone) != DNSLIB_EBADARG) { diag("Calling zone_shallow_copy with NULL source " "zone argument did not return DNSLIB_EBADARG!"); errors++; } lived = 1; lived = 0; - if (dnslib_zone_shallow_copy(zone, &zone) != DNSLIB_EBADARG) { + if (dnslib_zone_contents_shallow_copy(zone, &zone) != DNSLIB_EBADARG) { diag("Calling zone_shallow_copy with identical source " "and destination zone did not return DNSLIB_EBADARG!"); errors++; } lived = 1; - dnslib_zone_free(&zone); + dnslib_zone_contents_free(&zone); }, "zone: shallow copy NULL tests"); errors += lived != 1; /* example.com. */ - dnslib_zone_t *from = + dnslib_zone_t *from_zone = dnslib_zone_new(dnslib_node_new(&test_nodes_good[0].owner, - test_nodes_good[0].parent), 10, 1); + test_nodes_good[0].parent, 0), 10, 1); + dnslib_zone_contents_t *from = dnslib_zone_get_contents(from_zone); /* Add nodes to zone. */ for (int i = 1; i < TEST_NODES_GOOD; ++i) { dnslib_node_t *node = dnslib_node_new(&test_nodes_good[i].owner, - test_nodes_good[i].parent); + test_nodes_good[i].parent, + 0); if (node == NULL) { diag("zone: Could not create node."); return 0; } - if (dnslib_zone_add_node(from, node, 1, 1) != DNSLIB_EOK) { + if (dnslib_zone_contents_add_node(from, node, 1, 1, 1) != DNSLIB_EOK) { diag("zone: Could not add node. %s", dnslib_dname_to_str(node->owner)); // return 0; @@ -559,9 +562,9 @@ static int test_zone_shallow_copy() } /* Make a copy of zone */ - dnslib_zone_t *to = NULL; + dnslib_zone_contents_t *to = NULL; int ret = 0; - if ((ret = dnslib_zone_shallow_copy(from, &to) != DNSLIB_EOK)) { + if ((ret = dnslib_zone_contents_shallow_copy(from, &to) != DNSLIB_EOK)) { diag("Could not copy zone! %s", dnslib_strerror(ret)); return 0; } @@ -569,25 +572,25 @@ static int test_zone_shallow_copy() assert(to); /* Compare non-tree parts of the zone. */ - if (from->data != to->data) { - diag("Zone data field wrong after shallow copy!"); - errors++; - } +// if (from->data != to->data) { +// diag("Zone data field wrong after shallow copy!"); +// errors++; +// } - if (from->dtor != to->dtor) { - diag("Zone data destructor field wrong after shallow copy!"); - errors++; - } +// if (from->dtor != to->dtor) { +// diag("Zone data destructor field wrong after shallow copy!"); +// errors++; +// } if (from->node_count != to->node_count) { diag("Zone node count data field wrong after shallow copy!"); errors++; } - if (from->version != to->version) { - diag("Zone version data field wrong after shallow copy!"); - errors++; - } +// if (from->version != to->version) { +// diag("Zone version data field wrong after shallow copy!"); +// errors++; +// } if (from->apex != to->apex) { diag("Zone apex differ after shallow copy!"); @@ -613,13 +616,13 @@ static int test_zone_shallow_copy() /* Compare nodes, convert tree to array then compare those arrays. */ struct zone_test_param param1; param1.count = 0; - dnslib_zone_tree_apply_inorder(from, tree_node_to_array, - (void *)¶m1); + dnslib_zone_contents_tree_apply_inorder(from, tree_node_to_array, + (void *)¶m1); struct zone_test_param param2; param2.count = 0; - dnslib_zone_tree_apply_inorder(to, tree_node_to_array, - (void *)¶m2); + dnslib_zone_contents_tree_apply_inorder(to, tree_node_to_array, + (void *)¶m2); if (param1.count != param2.count) { diag("wrong tree"); @@ -701,8 +704,8 @@ static int test_zone_shallow_copy() } } - ck_stash_item_t *item1 = from->table->stash2; - ck_stash_item_t *item2 = to->table->stash2; + ck_stash_item_t *item1 = from->table->stash; + ck_stash_item_t *item2 = to->table->stash; while (item1 != NULL && item2 != NULL) { if (item1->item->key_length != item2->item->key_length) { @@ -730,8 +733,8 @@ static int test_zone_shallow_copy() } #endif - dnslib_zone_free(&from); - dnslib_zone_free(&to); + dnslib_zone_free(&from_zone); + dnslib_zone_contents_free(&to); return (errors == 0); }