1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

14 Commits

Author SHA1 Message Date
Andrew Tridgell
f6e53f433b merge from ronnie
(This used to be ctdb commit e7b57d38cf7255be823a223cf15b7526285b4f1c)
2008-02-04 20:07:15 +11:00
Ronnie Sahlberg
e0957ba4a4 add a function to return the first entry that is stored in a tree where
the key is an array of uint32_t

(This used to be ctdb commit 99553397aade4f1c4d17ef14dad406934958c80a)
2007-08-15 10:57:21 +10:00
Ronnie Sahlberg
adb49f02f0 change the mem hierarchy for trees. let the node be owned by the data
we store in the tree and use a node destructor so that when the data is 
talloc_free()d we also remove the node from the tree.

(This used to be ctdb commit b8dabd1811ebd85ee031563e95085f720a2fa04d)
2007-08-09 14:08:59 +10:00
Ronnie Sahlberg
18deb7e015 remove an unused function
(This used to be ctdb commit 38a26d1f3709fbce551bc3a7af8bacd0ff465bca)
2007-08-09 07:59:50 +10:00
Ronnie Sahlberg
203306400e add helpers to traverse a tree where the key is an array of uint32
(This used to be ctdb commit d328c66827cafff6356e96df2a782930274fe139)
2007-08-08 13:50:18 +10:00
Ronnie Sahlberg
9525b010aa add helpers to add/lookup/delete nodes in a tree where the key is an
array of uint32

(This used to be ctdb commit b7e0996e7735c8629d07453b9d335990c2dbc3db)
2007-08-08 12:30:12 +10:00
Ronnie Sahlberg
c1bfda5772 add a tree insert function that takes a callback fucntion to populate
the data of the tree.
this callback makes it more convenient to manage cases where one might 
want to insert multiple entries into the tree with the same key

rename the tree->tree pointer to tree->root  since this is supposed to 
point to the root of the tree

add a small test utility

(This used to be ctdb commit f6313bed9c53e0d1c36c9e08ac707e88e2a4fcd5)
2007-08-08 11:21:18 +10:00
Ronnie Sahlberg
49f0317b21 when inserting data in the tree, if there was already a node with the
same key then replace the data in the node with the new data and return 
the pointer to the previous data held in the node.

this allows a caller to avoid having to first check if a node already 
exists before inserting a possibly duplicate/colliding entry and lets 
the caller do whatever it needs to do after the fact.

(This used to be ctdb commit 6634cabb910c26400780d51727ff2d1ba5e16e36)
2007-08-08 08:20:46 +10:00
Ronnie Sahlberg
c76f323f73 fix the remaining bugs with tree delete that testing found.
the binary tree should work reasonably well now for delete.
insert always worked fine.

(This used to be ctdb commit 452cda26b206549504480b77483308b44cfa8b01)
2007-07-30 09:09:34 +10:00
Ronnie Sahlberg
8df376b3f0 remove dead code
(This used to be ctdb commit 97ffcda5e56f04aed2f4f8b889b4eb6311f69c4d)
2007-07-26 07:22:36 +10:00
Ronnie Sahlberg
84851b674c fix some remaining bugs with deleting nodes
(This used to be ctdb commit 8aec0e0bef794afce1d2abf762bfadee4ab7e619)
2007-07-26 07:21:32 +10:00
Ronnie Sahlberg
8e0a12463b there were situations where we were not guaranteed that a sibling had 2
child nodes which would cause a segv when trying to dereferencing those 
two child nodes in order to read their color

(This used to be ctdb commit 56f5fb8f8f3e667f5bc13f09fb5de01f5f2e0fae)
2007-07-25 17:53:55 +10:00
Ronnie Sahlberg
904e5ba55e if sibling is NULL it is a leaf node and thus black.
(This used to be ctdb commit 400488472ba64514fa6534d5de90edba6c5e27c6)
2007-07-25 17:22:04 +10:00
Ronnie Sahlberg
13e56a81a9 initial version of talloc based red-black trees
very initial version

(This used to be ctdb commit 121f5c9dfc8e441313e42d94bed9c9f13ec91398)
2007-07-24 18:51:13 +10:00