diff options
author | Marcus Boerger <helly@php.net> | 2004-11-01 23:16:43 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2004-11-01 23:16:43 +0000 |
commit | e1dfbfc695812c4da9ea2e099b880597b2e56873 (patch) | |
tree | e4c83038a4eba238a456bc1e23b257e537013458 | |
parent | 533e39ecf72ba51e8c261c3349f9f233daeeee43 (diff) | |
download | php-git-e1dfbfc695812c4da9ea2e099b880597b2e56873.tar.gz |
- Don't call beginChildren/endChildren if they don't do anything
-rwxr-xr-x | ext/spl/spl_iterators.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index df306f0c55..86ae919c2c 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -231,7 +231,9 @@ next_step: if (sub_iter->funcs->rewind) { sub_iter->funcs->rewind(sub_iter TSRMLS_CC); } - zend_call_method_with_0_params(&zthis, object->ce, &object->beginChildren, "beginchildren", NULL); + if (!object->beginChildren || object->beginChildren->common.scope != spl_ce_RecursiveIteratorIterator) { + zend_call_method_with_0_params(&zthis, object->ce, &object->beginChildren, "beginchildren", NULL); + } goto next_step; } /* no more elements */ @@ -239,7 +241,9 @@ next_step: iterator->funcs->dtor(iterator TSRMLS_CC); zval_ptr_dtor(&object->iterators[object->level].zobject); object->level--; - zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL); + if (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator) { + zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL); + } } else { return; /* done completeley */ } @@ -254,7 +258,9 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt sub_iter = object->iterators[object->level].iterator; sub_iter->funcs->dtor(sub_iter TSRMLS_CC); zval_ptr_dtor(&object->iterators[object->level--].zobject); - zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL); + if (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator) { + zend_call_method_with_0_params(&zthis, object->ce, &object->endChildren, "endchildren", NULL); + } } erealloc(object->iterators, sizeof(spl_sub_iterator)); object->iterators[0].state = RS_START; |