Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pavel Zhukov
Kea
Commits
d0b73dfd
Commit
d0b73dfd
authored
Jan 08, 2011
by
JINMEI Tatuya
Browse files
refactored nodeFission() a bit so that it would be consistent with the
documentation regarding exceptin guarantee.
parent
4d42a76c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/rbtree.h
View file @
d0b73dfd
...
...
@@ -738,10 +738,13 @@ RBTree<T>::nodeFission(RBNode<T>& node, const isc::dns::Name& base_name) {
// using auto_ptr here is to avoid memory leak in case of exceptoin raised
// after the RBNode creation
std
::
auto_ptr
<
RBNode
<
T
>
>
down_node
(
new
RBNode
<
T
>
(
sub_name
));
node
.
name_
=
base_name
;
// the rest of this function should be exception free so that it keeps
// consistent behavior (i.e., a weak form of strong exception guarantee)
// even if code after the call to this function throws an exception.
std
::
swap
(
node
.
data_
,
down_node
->
data_
);
std
::
swap
(
node
.
callback_required_
,
down_node
->
callback_required_
);
down_node
->
down_
=
node
.
down_
;
node
.
name_
=
base_name
;
node
.
down_
=
down_node
.
get
();
//root node of sub tree, the initial color is BLACK
down_node
->
color_
=
RBNode
<
T
>::
BLACK
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment