1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Optimize checks for DOMParentNode and DOMChildNode

Because we check the list with dom_sanity_check_node_list_for_insertion()
before dom_is_node_in_list(), then we don't have to check the object
type anymore in dom_is_node_in_list(), because
dom_sanity_check_node_list_for_insertion() will have already done that.

Closes GH-11914.
This commit is contained in:
Niels Dossche
2023-08-08 21:10:25 +02:00
parent 23ba4cde53
commit 620b6220c2

View File

@@ -128,12 +128,8 @@ static bool dom_is_node_in_list(const zval *nodes, uint32_t nodesc, const xmlNod
{
for (uint32_t i = 0; i < nodesc; i++) {
if (Z_TYPE(nodes[i]) == IS_OBJECT) {
const zend_class_entry *ce = Z_OBJCE(nodes[i]);
if (instanceof_function(ce, dom_node_class_entry)) {
if (dom_object_get_node(Z_DOMOBJ_P(nodes + i)) == node_to_find) {
return true;
}
if (dom_object_get_node(Z_DOMOBJ_P(nodes + i)) == node_to_find) {
return true;
}
}
}