From db1fd54ff3a1441a28360b48a020b42f6af7793b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 23 May 2013 16:15:48 +0100 Subject: Compare the name and prefix directly. Since this avoids string concatination, and (un)ref. --- src/core/node.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/core') 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) -- cgit v1.2.3