Commit f8879733 authored by Daniel Salzman's avatar Daniel Salzman

dbg: replace knot_dname_to_str with knot_dname_to_str_alloc

parent 1669c84b
......@@ -416,8 +416,8 @@ static int follow_cname(knot_pkt_t *pkt, uint16_t rrtype, struct query_data *qda
qdata->name = knot_cname_name(&cname_rr.rrs);
#ifdef KNOT_NS_DEBUG
char *cname_str = knot_dname_to_str(cname_node->owner);
char *target_str = knot_dname_to_str(qdata->name);
char *cname_str = knot_dname_to_str_alloc(cname_node->owner);
char *target_str = knot_dname_to_str_alloc(qdata->name);
dbg_ns("%s: FOLLOW '%s' -> '%s'\n", __func__, cname_str, target_str);
free(cname_str);
free(target_str);
......
......@@ -107,7 +107,7 @@ static int ns_put_covering_nsec3(const zone_contents_t *zone,
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str(prev->owner);
char *name = knot_dname_to_str_alloc(prev->owner);
dbg_ns_verb("Covering NSEC3 node: %s\n", name);
free(name);
);
......@@ -155,7 +155,7 @@ static int ns_put_nsec3_closest_encloser_proof(
if (zone_contents_nsec3params(zone) == NULL) {
dbg_ns_exec_verb(
char *name = knot_dname_to_str(zone->apex->owner);
char *name = knot_dname_to_str_alloc(zone->apex->owner);
dbg_ns_verb("No NSEC3PARAM found in zone %s.\n", name);
free(name);
);
......@@ -163,7 +163,7 @@ dbg_ns_exec_verb(
}
dbg_ns_exec_detail(
char *name = knot_dname_to_str((*closest_encloser)->owner);
char *name = knot_dname_to_str_alloc((*closest_encloser)->owner);
dbg_ns_detail("Closest encloser: %s\n", name);
free(name);
);
......@@ -186,14 +186,14 @@ dbg_ns_exec_detail(
assert(nsec3_node != NULL);
dbg_ns_exec_verb(
char *name = knot_dname_to_str(nsec3_node->owner);
char *name = knot_dname_to_str_alloc(nsec3_node->owner);
dbg_ns_verb("NSEC3 node: %s\n", name);
free(name);
name = knot_dname_to_str((*closest_encloser)->owner);
name = knot_dname_to_str_alloc((*closest_encloser)->owner);
dbg_ns_verb("Closest provable encloser: %s\n", name);
free(name);
if (next_closer != NULL) {
name = knot_dname_to_str(next_closer);
name = knot_dname_to_str_alloc(next_closer);
dbg_ns_verb("Next closer name: %s\n", name);
free(name);
} else {
......@@ -218,7 +218,7 @@ dbg_ns_exec_verb(
return KNOT_ERROR; /*servfail */
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str(new_next_closer);
char *name = knot_dname_to_str_alloc(new_next_closer);
dbg_ns_verb("Next closer name: %s\n", name);
free(name);
);
......@@ -254,7 +254,7 @@ static knot_dname_t *ns_wildcard_child_name(const knot_dname_t *name)
return NULL;
dbg_ns_exec_verb(
char *name = knot_dname_to_str(wildcard);
char *name = knot_dname_to_str_alloc(wildcard);
dbg_ns_verb("Wildcard: %s\n", name);
free(name);
);
......@@ -386,7 +386,7 @@ static int ns_put_nsec3_wildcard(const zone_contents_t *zone,
return KNOT_ERROR; /* servfail */
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str(next_closer);
char *name = knot_dname_to_str_alloc(next_closer);
dbg_ns_verb("Next closer name: %s\n", name);
free(name);
);
......@@ -480,7 +480,7 @@ static int ns_put_nsec_nxdomain(const knot_dname_t *qname,
}
dbg_ns_exec_verb(
char *name = knot_dname_to_str(previous->owner);
char *name = knot_dname_to_str_alloc(previous->owner);
dbg_ns_verb("Previous node: %s\n", name);
free(name);
);
......@@ -517,7 +517,7 @@ dbg_ns_exec_verb(
while (knot_dname_cmp(prev_new->owner, wildcard) > 0) {
dbg_ns_exec_verb(
char *name = knot_dname_to_str(prev_new->owner);
char *name = knot_dname_to_str_alloc(prev_new->owner);
dbg_ns_verb("Previous node: %s\n", name);
free(name);
);
......@@ -527,7 +527,7 @@ dbg_ns_exec_verb(
assert(knot_dname_cmp(prev_new->owner, wildcard) < 0);
dbg_ns_exec_verb(
char *name = knot_dname_to_str(prev_new->owner);
char *name = knot_dname_to_str_alloc(prev_new->owner);
dbg_ns_verb("Previous node: %s\n", name);
free(name);
);
......
......@@ -744,7 +744,7 @@ int zone_contents_remove_node(zone_contents_t *contents, const knot_dname_t *own
}
dbg_zone_exec_verb(
char *name = knot_dname_to_str(owner);
char *name = knot_dname_to_str_alloc(owner);
dbg_zone_verb("Removing zone node: %s\n", name);
free(name);
);
......@@ -801,8 +801,8 @@ int zone_contents_find_dname(const zone_contents_t *zone,
}
dbg_zone_exec_verb(
char *name_str = knot_dname_to_str(name);
char *zone_str = knot_dname_to_str(zone->apex->owner);
char *name_str = knot_dname_to_str_alloc(name);
char *zone_str = knot_dname_to_str_alloc(zone->apex->owner);
dbg_zone_verb("Searching for name %s in zone %s...\n",
name_str, zone_str);
free(name_str);
......@@ -818,10 +818,10 @@ dbg_zone_exec_verb(
*previous = prev;
dbg_zone_exec_detail(
char *name_str = (*node) ? knot_dname_to_str((*node)->owner)
char *name_str = (*node) ? knot_dname_to_str_alloc((*node)->owner)
: "(nil)";
char *name_str2 = (*previous != NULL)
? knot_dname_to_str((*previous)->owner)
? knot_dname_to_str_alloc((*previous)->owner)
: "(nil)";
dbg_zone_detail("Search function returned %d, node %s (%p) and prev: %s (%p)\n",
exact_match, name_str, *node, name_str2, *previous);
......@@ -933,7 +933,7 @@ int zone_contents_find_nsec3_for_name(const zone_contents_t *zone,
}
dbg_zone_exec_verb(
char *n = knot_dname_to_str(nsec3_name);
char *n = knot_dname_to_str_alloc(nsec3_name);
dbg_zone_verb("NSEC3 node name: %s.\n", n);
free(n);
);
......@@ -949,7 +949,7 @@ dbg_zone_exec_verb(
dbg_zone_exec_detail(
if (found) {
char *n = knot_dname_to_str(found->owner);
char *n = knot_dname_to_str_alloc(found->owner);
dbg_zone_detail("Found NSEC3 node: %s.\n", n);
free(n);
} else {
......@@ -958,7 +958,7 @@ dbg_zone_exec_detail(
if (prev) {
assert(prev->owner);
char *n = knot_dname_to_str(prev->owner);
char *n = knot_dname_to_str_alloc(prev->owner);
dbg_zone_detail("Found previous NSEC3 node: %s.\n", n);
free(n);
} else {
......
......@@ -170,9 +170,9 @@ int zone_tree_get_less_or_equal(zone_tree_t *tree,
}
dbg_zone_exec_detail(
char *name = knot_dname_to_str(owner);
char *name = knot_dname_to_str_alloc(owner);
char *name_f = (*found != NULL)
? knot_dname_to_str((*found)->owner)
? knot_dname_to_str_alloc((*found)->owner)
: "none";
dbg_zone_detail("Searched for owner %s in zone tree.\n",
......@@ -214,7 +214,7 @@ zone_node_t *zone_tree_get_next(zone_tree_t *tree,
fval = hattrie_iter_val(it);
hattrie_iter_free(it);
}
n = (zone_node_t *)*fval;
/* Next node must be non-empty and auth. */
if (n->rrset_count == 0 || n->flags & NODE_FLAGS_NONAUTH) {
......
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