Commit 338659d8 authored by Mark Andrews's avatar Mark Andrews
Browse files

4815. [bug] rbt_test.c:insert_and_delete needed to call

                        dns_rbt_addnode instead of dns_rbt_addname. [RT #46553]

(cherry picked from commit 04934b28)
parent b22dce13
4815. [bug] rbt_test.c:insert_and_delete needed to call
dns_rbt_addnode instead of dns_rbt_addname. [RT #46553]
4814. [cleanup] Use AS_HELP_STRING for consistent help text. [RT #46521]
4812. [bug] Minor improvements to stability and consistency of code
......
......@@ -902,6 +902,7 @@ insert_nodes(dns_rbt_t *mytree, char **names,
size_t *names_count, isc_uint32_t num_names)
{
isc_uint32_t i;
dns_rbtnode_t *node;
for (i = 0; i < num_names; i++) {
size_t *n;
......@@ -929,8 +930,10 @@ insert_nodes(dns_rbt_t *mytree, char **names,
build_name_from_str(namebuf, &fname);
name = dns_fixedname_name(&fname);
result = dns_rbt_addname(mytree, name, n);
node = NULL;
result = dns_rbt_addnode(mytree, name, &node);
if (result == ISC_R_SUCCESS) {
node->data = n;
names[*names_count] = isc_mem_strdup(mctx,
namebuf);
*names_count += 1;
......@@ -974,12 +977,17 @@ remove_nodes(dns_rbt_t *mytree, char **names,
}
static void
check_tree(dns_rbt_t *mytree, char **names, size_t names_count) {
check_tree(dns_rbt_t *mytree, char **names, size_t names_count,
unsigned int line)
{
isc_boolean_t tree_ok;
UNUSED(names);
ATF_CHECK_EQ(names_count + 1, dns_rbt_nodecount(mytree));
ATF_CHECK_EQ_MSG(names_count + 1, dns_rbt_nodecount(mytree),
"line:%u: %lu != %u", line,
(unsigned long)(names_count + 1),
dns_rbt_nodecount(mytree));
/*
* The distance from each node to its sub-tree root must be less
......@@ -1049,7 +1057,7 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) {
}
insert_nodes(mytree, names, &names_count, num_names);
check_tree(mytree, names, names_count);
check_tree(mytree, names, names_count, __LINE__);
isc_random_get(&num_names);
if (names_count > 0) {
......@@ -1060,12 +1068,12 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) {
}
remove_nodes(mytree, names, &names_count, num_names);
check_tree(mytree, names, names_count);
check_tree(mytree, names, names_count, __LINE__);
}
/* Remove the rest of the nodes */
remove_nodes(mytree, names, &names_count, names_count);
check_tree(mytree, names, names_count);
check_tree(mytree, names, names_count, __LINE__);
for (i = 0; i < 1024; i++) {
if (names[i] != 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