Skip to content

Commit 2946622

Browse files
committed
Move stricterror fetch to dom_child_removal_preconditions() body
1 parent 74116a4 commit 2946622

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ext/dom/parentnode/tree.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,16 +671,16 @@ void dom_parent_node_before(dom_object *context, zval *nodes, uint32_t nodesc)
671671
php_dom_pre_insert(context->document, fragment, parentNode, viable_previous_sibling);
672672
}
673673

674-
static zend_result dom_child_removal_preconditions(const xmlNode *child, int stricterror)
674+
static zend_result dom_child_removal_preconditions(const xmlNode *child, const dom_object *context)
675675
{
676676
if (dom_node_is_read_only(child) == SUCCESS ||
677677
(child->parent != NULL && dom_node_is_read_only(child->parent) == SUCCESS)) {
678-
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror);
678+
php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(context->document));
679679
return FAILURE;
680680
}
681681

682682
if (!child->parent) {
683-
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
683+
php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(context->document));
684684
return FAILURE;
685685
}
686686

@@ -690,9 +690,8 @@ static zend_result dom_child_removal_preconditions(const xmlNode *child, int str
690690
void dom_child_node_remove(dom_object *context)
691691
{
692692
xmlNode *child = dom_object_get_node(context);
693-
bool stricterror = dom_get_strict_error(context->document);
694693

695-
if (UNEXPECTED(dom_child_removal_preconditions(child, stricterror) != SUCCESS)) {
694+
if (UNEXPECTED(dom_child_removal_preconditions(child, context) != SUCCESS)) {
696695
return;
697696
}
698697

@@ -724,8 +723,7 @@ void dom_child_replace_with(dom_object *context, zval *nodes, uint32_t nodesc)
724723
viable_next_sibling = viable_next_sibling->next;
725724
}
726725

727-
bool stricterror = dom_get_strict_error(context->document);
728-
if (UNEXPECTED(dom_child_removal_preconditions(child, stricterror) != SUCCESS)) {
726+
if (UNEXPECTED(dom_child_removal_preconditions(child, context) != SUCCESS)) {
729727
return;
730728
}
731729

0 commit comments

Comments
 (0)