summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-05-23 15:15:48 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2013-05-23 15:15:48 (GMT)
commitdb1fd54ff3a1441a28360b48a020b42f6af7793b (patch)
tree6ea997e6c4075f2091c9ca63bd394a21e486717a
parent33d59e121f9f919f3fcb81dcc3225caca164f99b (diff)
downloadlibdom-db1fd54ff3a1441a28360b48a020b42f6af7793b.tar.gz
libdom-db1fd54ff3a1441a28360b48a020b42f6af7793b.tar.bz2
Compare the name and prefix directly. Since this avoids string concatination, and (un)ref.
-rw-r--r--src/core/node.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/core/node.c b/src/core/node.c
index a09bf97..a59cc01 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -1595,7 +1595,6 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
dom_node_internal *other, bool *result)
{
dom_exception err = DOM_NO_ERR;
- dom_string *s1 = NULL, *s2 = NULL;
dom_namednodemap *m1 = NULL, *m2 = NULL;
dom_nodelist *l1 = NULL, *l2 = NULL;
*result = false;
@@ -1610,20 +1609,14 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
assert(node->owner != NULL);
assert(other->owner != NULL);
- /* Compare the node names (and prefix) */
- err = dom_node_get_node_name(node, &s1);
- if (err != DOM_NO_ERR) {
- /* error */
- goto cleanup;
- }
-
- err = dom_node_get_node_name(other, &s2);
- if (err != DOM_NO_ERR) {
- /* error */
+ /* Compare node name */
+ if (dom_string_isequal(node->name, other->name) == false) {
+ /* different */
goto cleanup;
}
- if (dom_string_isequal(s1, s2) == false) {
+ /* Compare prefix */
+ if (dom_string_isequal(node->prefix, other->prefix) == false) {
/* different */
goto cleanup;
}
@@ -1679,11 +1672,6 @@ dom_exception _dom_node_is_equal(dom_node_internal *node,
*result = true;
cleanup:
- if (s1 != NULL)
- dom_string_unref(s1);
- if (s2 != NULL)
- dom_string_unref(s2);
-
if (m1 != NULL)
dom_namednodemap_unref(m1);
if (m2 != NULL)