]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4815. [bug] rbt_test.c:insert_and_delete needed to call
authorMark Andrews <marka@isc.org>
Mon, 13 Nov 2017 04:26:35 +0000 (15:26 +1100)
committerMark Andrews <marka@isc.org>
Mon, 13 Nov 2017 04:27:12 +0000 (15:27 +1100)
                        dns_rbt_addnode instead of dns_rbt_addname. [RT #46553]

(cherry picked from commit 04934b28ea851c22ee78842212770db5abacb0fb)

CHANGES
lib/dns/tests/rbt_test.c

diff --git a/CHANGES b/CHANGES
index 1094a587d474724b5f8cc75b5c187ac5d73c94e0..cd0e5514e55aa375adabf4c667d3cef40c07233f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+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
index 616f23dbe33723f03be25d1cc472d3e7e2798227..e719c86b83789aa54db764f7cb956c7b110b088b 100644 (file)
@@ -894,6 +894,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;
@@ -921,8 +922,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;
@@ -966,12 +969,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
@@ -1041,7 +1049,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) {
@@ -1052,12 +1060,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) {