Skip to content

Commit 88449f6

Browse files
committed
Simplify control flow for special case of php_dom_iterator_move_forward()
1 parent 899b916 commit 88449f6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ext/dom/dom_iterators.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ static void php_dom_iterator_current_key(zend_object_iterator *iter, zval *key)
176176
static void php_dom_iterator_move_forward(zend_object_iterator *iter) /* {{{ */
177177
{
178178
xmlNodePtr curnode = NULL;
179-
bool do_curobj_undef = 1;
180179

181180
php_dom_iterator *iterator = (php_dom_iterator *)iter;
182181

@@ -195,9 +194,8 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter) /* {{{ */
195194
zend_hash_move_forward_ex(nodeht, &iterator->pos);
196195
if ((entry = zend_hash_get_current_data_ex(nodeht, &iterator->pos))) {
197196
zval_ptr_dtor(&iterator->curobj);
198-
ZVAL_UNDEF(&iterator->curobj);
199197
ZVAL_COPY(&iterator->curobj, entry);
200-
do_curobj_undef = 0;
198+
return;
201199
}
202200
} else {
203201
if (objmap->nodetype == XML_ATTRIBUTE_NODE ||
@@ -237,10 +235,9 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter) /* {{{ */
237235
}
238236
}
239237
err:
240-
if (do_curobj_undef) {
241-
zval_ptr_dtor(&iterator->curobj);
242-
ZVAL_UNDEF(&iterator->curobj);
243-
}
238+
zval_ptr_dtor(&iterator->curobj);
239+
ZVAL_UNDEF(&iterator->curobj);
240+
244241
if (curnode) {
245242
php_dom_create_object(curnode, &iterator->curobj, objmap->baseobj);
246243
}

0 commit comments

Comments
 (0)