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;
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;
}
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
}
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) {
}
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) {