[libxml++] Node::get_parent(): Removed code duplication.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml++] Node::get_parent(): Removed code duplication.
- Date: Tue, 19 Oct 2010 07:35:49 +0000 (UTC)
commit d8a1b4273139ad6c43a2595db85470c6061913dc
Author: Knut Aksel Røysland <knutroy ifi uio no>
Date: Thu Oct 14 22:19:23 2010 +0200
Node::get_parent(): Removed code duplication.
* libxml++/nodes/node.cc: get_parent() const: Use const_cast<> to call
the non-const version, instead of duplicating the code.
ChangeLog | 7 +++++++
libxml++/nodes/node.cc | 3 +--
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 917c622..50626bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-19 Knut Aksel Røysland <knutroy ifi uio no>
+
+ Node::get_parent(): Removed code duplication.
+
+ * libxml++/nodes/node.cc: get_parent() const: Use const_cast<> to call
+ the non-const version, instead of duplicating the code.
+
2.32.0:
2010-10-14 Murray Cumming <murrayc murrayc com>
diff --git a/libxml++/nodes/node.cc b/libxml++/nodes/node.cc
index e4bb723..7cf34d3 100644
--- a/libxml++/nodes/node.cc
+++ b/libxml++/nodes/node.cc
@@ -27,8 +27,7 @@ Node::~Node()
const Element* Node::get_parent() const
{
- return cobj()->parent && cobj()->parent->type == XML_ELEMENT_NODE ?
- static_cast<const Element*>(cobj()->parent->_private) : 0;
+ return const_cast<Node*>(this)->get_parent();
}
Element* Node::get_parent()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]