Commit ec80744a authored by David Lawrence's avatar David Lawrence
Browse files

The ADD_ANCESTOR macro now checks for the required memory, since it is used

in a lot of places now.  It _returns_ if it fails to get the necessary memory,
so any function using it should be returning a dns_result_t.

chain_name moved toward start of file, for inlining by findnode.

move_chain_to_last broke out some functionality of dns_rbtnodechain_last
(which now calls it), also for the benefit of findnode.

dns_rbtnodechain_init on the chain used by addnode.

All of the new_foundname concatenation gook was removed from findnode,
which now just sets foundname by using chain_name.

The chain set up by findnode points to the predecessor when the searched
for name is not found.

nodechain_current was changed to take name, origin and node parameters while
returning a dns_result_t.  This allows the chain returned by findnode to
be named.

The nodechain_{first,last,prev} use nodechain_current to set their
names and origins.  nodechain_next does not need it because it will never
have to do the "set the origin to '.' and remove '.' from names in the
root level" bit.  The root level will never be more than one name, and
everything in the megatree is a successor to that node, so 'next' never
reaches the root level.
parent 066ae48b
......@@ -94,6 +94,7 @@ typedef dns_result_t (*dns_rbtfindcallback_t)(dns_rbtnode_t *node,
* because additions or removals can change the path from the root to the node
* the chain has targetted.
* XXX add _current
* The dns_rbtnodechain_ functions _first, _last, _prev and _next all take
* dns_name_t parameters for the name and the origin. 'name' will end up
* pointing to the name data and offsets that are stored at the node (and thus
......@@ -507,9 +508,11 @@ dns_rbtnodechain_invalidate(dns_rbtnodechain_t *chain);
* 'chain' is no longer suitable for use, and uses no dynamic storage.
dns_rbtnode_t *
dns_rbtnodechain_current(dns_rbtnodechain_t *chain);
dns_rbtnodechain_current(dns_rbtnodechain_t *chain, dns_name_t *name,
dns_name_t *origin, dns_rbtnode_t **node);
* XXX update docs
* Return the node to which the chain is currently pointed.
* Notes:
This diff is collapsed.
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