Skip to content

Commit 05c46b7

Browse files
authored
Small optimization in php_sxe_get_first_node() by avoiding unwrapping iterator data (#12194)
1 parent df0aca3 commit 05c46b7

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

ext/simplexml/simplexml.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,8 @@ static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value, SXE
7878

7979
static xmlNodePtr php_sxe_get_first_node(php_sxe_object *sxe, xmlNodePtr node) /* {{{ */
8080
{
81-
php_sxe_object *intern;
82-
xmlNodePtr retnode = NULL;
83-
8481
if (sxe && sxe->iter.type != SXE_ITER_NONE) {
85-
php_sxe_reset_iterator(sxe, 1);
86-
if (!Z_ISUNDEF(sxe->iter.data)) {
87-
intern = Z_SXEOBJ_P(&sxe->iter.data);
88-
GET_NODE(intern, retnode)
89-
}
90-
return retnode;
82+
return php_sxe_reset_iterator(sxe, 1);
9183
} else {
9284
return node;
9385
}

0 commit comments

Comments
 (0)