helly Mon Nov 1 18:16:43 2004 EDT Modified files: /php-src/ext/spl spl_iterators.c Log: - Don't call beginChildren/endChildren if they don't do anything http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.53&r2=1.54&ty=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.53 php-src/ext/spl/spl_iterators.c:1.54 --- php-src/ext/spl/spl_iterators.c:1.53 Mon Nov 1 18:02:10 2004 +++ php-src/ext/spl/spl_iterators.c Mon Nov 1 18:16:43 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.c,v 1.53 2004/11/01 23:02:10 helly Exp $ */ +/* $Id: spl_iterators.c,v 1.54 2004/11/01 23:16:43 helly Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -231,7 +231,9 @@ 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 @@ 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 @@ 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;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php