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

262 Commits

Author SHA1 Message Date
David Lawrence
b79e66b06d While searching in dns_rbt_findnode(), cope with the possibility that
a bitstring label might be founding things from any label of a
multilabel search_name.
2001-05-31 11:03:33 +00:00
David Lawrence
ceda09e07a removed stale #define DEBUG that my own comment said I was supposed to remove. 2001-04-12 21:18:14 +00:00
David Lawrence
cace8ff3bd use ISC_MAGIC to define the magic number 2001-04-12 00:37:55 +00:00
Andreas Gustafsson
dd57718608 #include <isc/print.h> 2001-03-09 23:38:00 +00:00
David Lawrence
a09c545af1 join_nodes is removed; node joining is no longer done at any time, because
it corrupts active chains and can change the data at a node which
someone might be using.  (In the latter case, though the full name from
the root was still intact, and the ->data member was not altered, other
values like the partial name ndata and offsets could change.)

New functions dns_rbt_fullnamefromnode() and dns_rbt_formatnodename(),
for getting a dns_name_t and filling a char buffer, respectively, with
the complete name of a node from the root.

rbtnode.is_root was being treated as isc_boolean_t even though it was bitfield
of width 1.  This worked fine, but wasn't consistent with ISC style, and
would have puked if someone decided to change isc_true from 1 (unlikely
as that is).  Yeah, anal, I know.
2001-03-08 01:08:39 +00:00
Brian Wellington
d752e5c19e removed pointless code (an if statement checking something that had been
INSISTed on the previous line).
2001-02-28 20:20:18 +00:00
Brian Wellington
9a41936e3d current_root was uninitialized at the start of dns_rbt_findnode(). This
has no real effect, but it's still good to fix it.
2001-02-21 23:21:28 +00:00
Brian Wellington
c5945fe694 Fix a potential bitstring bug. 2001-02-21 02:27:56 +00:00
Brian Wellington
4e8eba14a0 reinstate an INSIST() referenced in [RT #421] 2001-02-21 02:01:15 +00:00
Brian Wellington
7222f9f321 The optimization to avoid compares after hashtable matches didn't work when
the matched node contained multiple labels.
2001-02-10 22:46:24 +00:00
Brian Wellington
1c1f5e1911 The root node was added to the hashtable twice, which could lead to an
infinite loop. [RT #840]
2001-02-09 18:48:57 +00:00
Brian Wellington
65bc8f2af8 When assigning a bucket lock to an rbt node, use the hash of the full name,
rather than the hash of the partial name stored in the node.  This more
evenly distributes nodes across locks.

This change only takes effect when DNS_RBT_USEHASH is defined, and also changes
the rbt so that the hashtable is created when the first node is created in the
tree, not after 64 nodes are added.
2001-02-09 01:26:51 +00:00
Brian Wellington
15bc0af6a1 chain_name() built the fully qualified name in a very inefficient way.
Reversing the order of the concatenations makes it significantly faster.
2001-02-05 20:07:20 +00:00
Brian Wellington
70b4889c85 A minor optimation to the rbt hash code that should reduce the number
of calls to dns_name_fullcompare().
2001-01-22 20:41:43 +00:00
Brian Wellington
499b34cea0 copyright update 2001-01-09 22:01:04 +00:00
Brian Wellington
6d5032f9a2 Micro-optimizations:
- use the DNS_NAME_INIT macro in name.c
	- create dns_name_copy() and use it instead of dns_name_concatenate()
	  when doing a copy.
2001-01-03 00:05:15 +00:00
Brian Wellington
78838d3e0c 8 space -> tab conversion 2000-12-11 19:24:30 +00:00
Brian Wellington
08e57545c2 Allow the hashing code in the rbt to be disabled (to save memory). This
should eventually be configurable at runtime, or at least with a
configure option, but now it's just a #define in rbt.h.
2000-11-18 00:55:25 +00:00
David Lawrence
e94e2fe29d cope with the possibility that the prefix of a name
split within a bitstring label might have been compacted to have fewer
labels than what was expected
2000-11-14 23:51:24 +00:00
David Lawrence
b65f2ab14a 534. [func] Ancestors have been removed from RBT chains. Ancestor
information can be discerned via node parent pointers.

 533.	[func]		Incorporated name hashing into the RBT database to
			improve search speed.

There is still evidence of a bug with regard to bitstring labels.  It shows
up in bin/test/rbt/t_rbt -x -t 4 when the assertion at lib/dns/rbt.c:1631
is uncommented -- essentially a bitstring node's location in the hashtable
is not getting properly updated at some point.  This shouldn't affect
searching, because a bitstring label as the parent of a new level will
generally cause the standard old binary search to be done.  I will be looking
at this more closely in the very near future.
2000-10-25 07:21:31 +00:00
Brian Wellington
48d861c067 The node counting stuff didn't work. 2000-08-03 21:34:27 +00:00
Brian Wellington
83e6eb0dfe Add routines to count the number of nodes in a database and an rbt. 2000-08-03 19:46:37 +00:00
David Lawrence
40f53fa8d9 Trailing whitespace trimmed. Perhaps running "perl util/spacewhack.pl in your
own CVS tree will help minimize CVS conflicts.  Maybe not.
Blame Graff for getting me to trim all trailing whitespace.
2000-08-01 01:33:37 +00:00
David Lawrence
c5944292e9 361. [func] When the RBT find or chain functions set the name and
origin for a node that stores the root label
			the name is now set to an empty name, instead of ".",
			to simplify later use of the name and origin by
			dns_name_concatenate(), dns_name_totext() or
			dns_name_format().

 360.	[func]		dns_name_totext() and dns_name_format() now allow
			an empty name to be passed, which is formatted as "@".
2000-07-31 23:27:25 +00:00
David Lawrence
9658892dbc revert the changes to dns_name_format() back to dns_name_totext() because
dns_name_format() does not print absolute names
2000-07-31 22:34:01 +00:00
David Lawrence
15a4474541 word wrap copyright notice at column 70 2000-07-27 09:55:03 +00:00
Andreas Gustafsson
5aa7bca733 dns_rbt_printnode() formatted the node name
into a buffer of 255 char pointers, not 255 chars; changed it
to use dns_name_format()
2000-07-21 22:08:42 +00:00
David Lawrence
891a1bead8 Use new function dns_name_reset() to make a name have no data, instead
of dns_name_concatenate(NULL, NULL, name, NULL).

Define DNS_NAME_USELINE to get macroized name functions.  Removed
older FAST_COUNTLABELS and FAST_ISABSOLUTE to use standard name
interface, which are covered by DNS_NAME_USEINLINE.
2000-07-14 19:17:39 +00:00
David Lawrence
9fb4b3f08a Do not return an exact match from dns_rbt_findnode() when the exact
match does not have associated data and DNS_RBTFIND_EMPTYDATA is not set.
Return DNS_R_PARTIALMATCH instead if there is a superdomain with
data, or ISC_R_NOTFOUND if no superdomain has data.

Make dns_rbt_findname() honor DNS_RBTFIND_EMPTYDATA, per the rbt.h
documentation that has been saying it will.  It didn't.
2000-07-06 23:54:45 +00:00
David Lawrence
03052a178c dns_rbt_deletefromlevel() did not need its dns_rbt_t argument 2000-06-19 22:55:42 +00:00
David Lawrence
92ab6defb6 don't redefine DNS_RBT_ANCESTORBLOCK to a tiny size when ISC_MEM_DEBUG is
defined, as it is by default now.  huge performance hit that we would
likely have been slow to notice if not for the t_rbt chain tests
having a bug. :-)
2000-06-06 23:25:29 +00:00
David Lawrence
fccb3e6c67 When joining nodes, set parent pointers of the left and right children of
the upper node (if they exist) to point to the new node.
2000-05-19 05:58:48 +00:00
David Lawrence
092b4e5359 The deletion assertion failure reported in RT #112 has been fixed; a pointer
should have been set to NULL when the top of a level was being rotated but
instead it was set to the node which pointed down to the level of the deleted
node.

rotate_left and rotate_right no longer take a parent parameter, since they
don't need it with the existence of parent pointers.

dns_rbt_deletefromlevel now takes a pointer to the pointer of the root of
the level as a parameter so that it doesn't have to rediscover the root that
its caller (dns_rbt_deletenode) already discovered.

dns_rbt_deletefromlevel did some (minor) pointless work with the sibling of the
deleted node before the color fixup loop was entered; it does so no more.

forward function declarations changed to ISC style.
2000-05-19 04:42:08 +00:00
David Lawrence
6028d1ce03 Needs string.h for function prototypes. For some reason gcc and other
compilers do not warn about the missing str*/mem* prototypes.
2000-05-08 19:23:32 +00:00
David Lawrence
1a69a1a78c Megacommit of dozens of files.
Cleanup of redundant/useless header file inclusion.

ISC style lint, primarily for function declarations and standalone
comments -- ie, those that appear on a line without any code, which
should be written as follows:
   /*
    * This is a comment.
    */
2000-05-08 14:38:29 +00:00
Bob Halley
82a1986c04 include isc/util.h; LOCK to LOCKNUM 2000-04-28 01:08:52 +00:00
David Lawrence
6e49e91bd0 103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
                                isc_buffer_base(b)          (pointer)
                                isc_buffer_current(b)       (pointer)
                                isc_buffer_active(b)        (pointer)
                                isc_buffer_used(b)          (pointer)
                                isc_buffer_length(b)            (int)
                                isc_buffer_usedlength(b)        (int)
                                isc_buffer_consumedlength(b)    (int)
                                isc_buffer_remaininglength(b)   (int)
                                isc_buffer_activelength(b)      (int)
                                isc_buffer_availablelength(b)   (int)
                        Removed:
                                ISC_BUFFER_USEDCOUNT(b)
                                ISC_BUFFER_AVAILABLECOUNT(b)
                                isc_buffer_type(b)
                        Changed names:
                                isc_buffer_used(b, r) ->
                                        isc_buffer_usedregion(b, r)
                                isc_buffer_available(b, r) ->
                                        isc_buffer_available_region(b, r)
                                isc_buffer_consumed(b, r) ->
                                        isc_buffer_consumedregion(b, r)
                                isc_buffer_active(b, r) ->
                                        isc_buffer_activeregion(b, r)
                                isc_buffer_remaining(b, r) ->
                                        isc_buffer_remainingregion(b, r)

                        Buffer types were removed, so the ISC_BUFFERTYPE_*
                        macros are no more, and the type argument to
                        isc_buffer_init and isc_buffer_allocate were removed.
                        isc_buffer_putstr is now void (instead of isc_result_t)
                        and requires that the caller ensure that there
                        is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
David Lawrence
d7197f2ab0 Add DNS_RBTFIND_NOPREDECESSOR to specify that the predecessor searching code
of dns_rbt_findnode should be skipped.  Nothing external uses it yet, but
when the chain option is NULL, this option is set internally as predecessor
searching is irrelevant.  (It was skipped before now, but via a different
mechanism.)

Add DNS_RBTFIND_NOOPTIONS to make it clear what the options parameter of
dns_rbt_find* is when no options are passed, and use it in dns_rbt_deletename.

REQUIRE that DNS_RBTFIND_NOEXACT and DNS_RBTFIND_NOPREDECESSOR are mutually
exclusive to dns_rbt_findnode.
2000-04-24 21:18:16 +00:00
Bob Halley
0a09237aa0 add noexact matching option 2000-04-19 18:21:24 +00:00
David Lawrence
c80dde0676 Comments about enhancements that could be made now that parent pointers exist. 2000-04-12 21:38:04 +00:00
David Lawrence
510f4bdcb6 static zapnode_and_fixlevels renamed to public dns_rbt_deletenode.
deletion no long requires a valid chain.  chain gook removed from all
of the deletion functions.

Minor unrelated doc & code convention cleanups.
2000-04-12 21:31:02 +00:00
David Lawrence
5d4f11b265 The RBT now maintains a parent pointer at each node. 2000-04-06 18:47:07 +00:00
Bob Halley
7d32c065c7 update copyright 2000-02-03 23:50:32 +00:00
Michael Graff
3ddd814a97 dns_result_t is no more. s/dns_result_t/isc_result_t/ -- more later, when I need a break. 1999-12-23 00:09:04 +00:00
Mark Andrews
19c5c23ef6 fix compiler warning: While loop condition is always non-zero.
nxt_30.c enforce type range to 1..127. DNS_R_RANGE otherwise.
1999-11-03 01:07:02 +00:00
David Lawrence
00a2ffb4ee fluff: compare a pointer to NULL 1999-11-03 00:17:11 +00:00
David Lawrence
0262a14d94 style fluff: "if (parent != NULL)" not "if (parent)" 1999-10-31 15:25:11 +00:00
Mark Andrews
acf87ed0b5 suppress ambigious else messages even when they are not. 1999-10-25 17:01:30 +00:00
David Lawrence
401fc772b1 Major:
deletion bug fixed that could orphan a large section of the tree.  the
  "parent" argument to rotate_left or rotate_right was sometimes not
  really the parent of the rotation vertex, because the parent's parent
  was not correctly reidentified after a rotation done on the parent.

Minor:
  forward static declaration of dns_rbt_printnodename, useful in debugging.

  level_matches set correctly for exact match in dns_rbt_findnode (it was
  one too few, but this was minor because as yet level_matches is only
  used by other code when a partial match was made.

  insist 'node' is a child of 'parent' in rotate_left and rotate_right

  compare a pointer explicitly to NULL that was just "if (pointer)"

  "would would" in a comment changed to just one "would".
1999-10-16 19:44:54 +00:00
Bob Halley
a6aa36b513 make findnode work on a completely empty tree 1999-10-15 01:35:23 +00:00