Skip to content

Commit 5db0595

Browse files
authored
Move more common code into php_dom_next_in_tree_order() (#14363)
1 parent 8a87206 commit 5db0595

File tree

6 files changed

+4
-25
lines changed

6 files changed

+4
-25
lines changed

ext/dom/element.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,11 +1023,6 @@ static void dom_remove_eliminated_ns(xmlNodePtr node, xmlNsPtr eliminatedNs)
10231023

10241024
if (node->type == XML_ELEMENT_NODE) {
10251025
dom_remove_eliminated_ns_single_element(node, eliminatedNs);
1026-
1027-
if (node->children) {
1028-
node = node->children;
1029-
continue;
1030-
}
10311026
}
10321027

10331028
node = php_dom_next_in_tree_order(node, base);

ext/dom/namespace_compat.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,6 @@ PHP_DOM_EXPORT void php_dom_libxml_reconcile_modern(php_dom_libxml_ns_mapper *ns
439439

440440
if (node->type == XML_ELEMENT_NODE) {
441441
php_dom_libxml_reconcile_modern_single_element_node(&ctx, node);
442-
443-
if (node->children) {
444-
node = node->children;
445-
continue;
446-
}
447442
}
448443

449444
node = php_dom_next_in_tree_order(node, base);

ext/dom/php_dom.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,11 +1762,6 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr basep, xmlNodePtr nodep,
17621762
(*cur)++;
17631763
}
17641764
}
1765-
1766-
if (nodep->children) {
1767-
nodep = nodep->children;
1768-
continue;
1769-
}
17701765
}
17711766

17721767
nodep = php_dom_next_in_tree_order(nodep, basep);

ext/dom/xml_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ static zend_always_inline php_dom_libxml_ns_mapper *php_dom_get_ns_mapper(dom_ob
9191

9292
static zend_always_inline xmlNodePtr php_dom_next_in_tree_order(const xmlNode *nodep, const xmlNode *basep)
9393
{
94+
if (nodep->type == XML_ELEMENT_NODE && nodep->children) {
95+
return nodep->children;
96+
}
97+
9498
if (nodep->next) {
9599
return nodep->next;
96100
} else {

ext/dom/xml_document.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ static void dom_mark_namespaces_as_attributes_too(php_dom_libxml_ns_mapper *ns_m
7777
while (node != NULL) {
7878
if (node->type == XML_ELEMENT_NODE) {
7979
php_dom_ns_compat_mark_attribute_list(ns_mapper, node);
80-
81-
if (node->children) {
82-
node = node->children;
83-
continue;
84-
}
8580
}
8681

8782
node = php_dom_next_in_tree_order(node, NULL);

ext/xsl/xsltprocessor.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ static void xsl_build_ns_map(xmlHashTablePtr table, xsltStylesheetPtr sheet, php
155155
xsl_add_ns_to_map(table, sheet, cur, prefix, ns->href);
156156
}
157157
}
158-
159-
if (cur->children != NULL) {
160-
cur = cur->children;
161-
continue;
162-
}
163158
}
164159

165160
cur = php_dom_next_in_tree_order(cur, (const xmlNode *) doc);

0 commit comments

Comments
 (0)