2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

126 Commits

Author SHA1 Message Date
David Lawrence
f39a760ab0 formatting fixups (a few lines were over 79 char). 1999-03-16 22:57:32 +00:00
David Lawrence
194f54f4da New parameter to dns_rbt_find{name,node} will return the full dns_name_t
of the node that is found.

Avoids doing any memory allocation when building ancestor chain in 99%
of the cases.
1999-03-16 16:10:36 +00:00
David Lawrence
bd1190c84b no more need for mem_failure in rbt_nodechain_t, since findnode now
returns a dns_result_t.

dns_rbt_created requires deleter_arg NULL if deleter is NULL.

dns_rbt_addnode always returns DNS_R_EXISTS if the node is found, regardless
of if it has data.

dns_rbt_addname will add the data and return SUCCESS if addnode says
EXISTS but there is no data at the node.

make sure memory is freed even when get_ancestor_mem to reallocate fails.

partialmatch returned by findnode must have data associated with it.

fixed up deletename; prematurely exited without freeing chain memory if
the node was not found.  made deletename responsible for identifying whether
a node could be removed rather than zapnode.

turned a few of the print support functions static.
1999-03-12 05:00:32 +00:00
David Lawrence
62f178f499 Preserve the storage location of the down node of a pair of joined nodes
when deleting, where possible.
1999-03-11 22:04:24 +00:00
David Lawrence
6a0cb547d4 When splitting a node, increment PADBYTES by the amount that is truncated,
instead of just setting PADBYTES to that amount (this affects when a node
is split twice.)
1999-03-11 20:07:49 +00:00
David Lawrence
f036af2c71 rbtnode struct adapted with more bitfields to represent color,
name attributes, name length, offset length, and number of bytes
of "padding" that are left over when a node is split.

adjusted node splitting algorithm to preserve the original location
of the lower portion of the split node (eg, when a node has "a.b" as
its name and is split into "a" and "b", "a" retains the same address
space as "a.b".)
1999-03-11 18:54:31 +00:00
David Lawrence
587fc7b519 Revised dns_rbt_findname and dns_rbt_findnode to find the closest match
when an exact match cannot be found.  This changed the calling interface,
which necessitated changes to rbtdb.c and compress.c.
1999-03-04 21:03:29 +00:00
David Lawrence
6735f1e886 arguments for common_labels and common_bits to dns_name_fullcompare
are unsigned ints
1999-03-04 02:35:04 +00:00
David Lawrence
005c7ad70f Use dns_name_fullcompare() and remove internal comparison functions.
Allow root label to be in its own level (and thus have data associated with it.)

Avoid retraversal of level in dns_rbt_addonlevel().
1999-03-03 20:01:49 +00:00
Mark Andrews
52637f592f Add wire compression. 1999-02-22 07:24:05 +00:00
Michael Graff
882350d11c Clean up many compiler warnings. 1999-02-11 06:38:12 +00:00
Bob Halley
1630fce031 performance enhancements, deleter arg 1999-02-06 01:27:35 +00:00
Bob Halley
1bf0b455b6 add XXXRTH comments 1999-02-06 00:00:41 +00:00
Bob Halley
fe47f41b13 eliminate compiler warnings (signed vs. unsigned) 1999-02-02 01:18:51 +00:00
David Lawrence
8e1f35e1d7 free ancestor memory allocated in addonlevel 1999-02-01 03:26:00 +00:00
David Lawrence
265c6d0526 the space for the ancestor chain in addonlevel is now dynamic. 1999-01-31 19:55:52 +00:00
David Lawrence
94231e2288 added a function for getting space for ancestor nodes in the node_chain,
and use it within dns_rbt_findnode.

moved the guts of dns_rbt_deletename into its own function to clean up
the freeing of ancestor memory into just one location.

deletefromlevel required that ancestor_count be > 1, which would abort
trying to delete the root of the tree when the root had no children.
1999-01-31 18:43:57 +00:00
David Lawrence
97940a084c don't free the down data pointer in join_nodes. (what was i thinking?!)
do free the ancestor chain in dns_rbt_deletename
1999-01-31 16:50:01 +00:00
David Lawrence
d65db52903 deletetree does not take a root parameter any more.
removed the SET_foo macros left over from the rbtgen.c pseudo-code.
1999-01-31 01:35:04 +00:00
David Lawrence
0f5962ac3e many changes.
ancestor/level history no longer kept in rbt structure; node_chain structure
was created for this purpose, and each dns_rbt_deletename call will pass
the chain structure to dns_rbt_findnode.

color enum removed from rbtnode structure; single bit used instead

length of name in rbtnode no longer kept as int in rbtnode structure;
stored as single byte just past end of rbtnode, and the actual name data starts
two bytes past the end.

dns_rbt_create takes additional argument that is a pointer to a function
which is responsible for deleting the space pointed to by an rbtnode's data
pointer when the node is removed.

dns_rbt_addnode renamed to dns_rbt_addonlevel so that dns_rbt_addnode could
be a public function that can provide the address of the new node back
to the caller.

removed several #if 0 blocks that were held over from when parent pointers
were used.
1999-01-31 00:52:53 +00:00
Bob Halley
70db22e93b comparisions should be case-insensitive 1999-01-30 04:27:13 +00:00
David Lawrence
c4c843edb3 Basic deletion works again. Parent pointers have been expunged from
all the code.
1999-01-27 01:48:55 +00:00
David Lawrence
72d4e9f06f Don't use deletenode in deletetree, because the color fixups do not need
to be done, just the memory recovered.
1999-01-26 03:31:53 +00:00
David Lawrence
73d62a89f1 A variety of changes.
dns_rbt_node_t changed to dns_rbtnode_t to match ISC conventions.

  main() test routine and support functions removed, to be put in
    bin/tests/rbt_test.c

  adding a node and rotating left/right taught to not use parent pointers.

  deletion disabled because it currently does not know how to not use
    parent pointers, and since they are not being maintained by insertion,
    deleting has no prayer of working.

  several isc_result_t returns changed to dns_result_t.
1999-01-25 15:46:30 +00:00
Michael Graff
64ba6e4cc3 make this go on the Alpha. 1999-01-22 04:35:11 +00:00
David Lawrence
f389bc2c9e redblack.c include/dns/redblack.h
Initial (committed) implementation of red/black tree of trees.

Makefile.in:
	add redblack.o to libdns.
1999-01-20 10:13:43 +00:00