helly Mon Feb 6 01:42:37 2006 UTC Modified files: /php-src/ext/spl spl_array.c Log: - Simplify http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.93&r2=1.94&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.93 php-src/ext/spl/spl_array.c:1.94 --- php-src/ext/spl/spl_array.c:1.93 Mon Feb 6 01:30:26 2006 +++ php-src/ext/spl/spl_array.c Mon Feb 6 01:42:37 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.93 2006/02/06 01:30:26 helly Exp $ */ +/* $Id: spl_array.c,v 1.94 2006/02/06 01:42:37 helly Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -119,6 +119,8 @@ } /* }}} */ +zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); + /* {{{ spl_array_object_new */ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, zval *orig TSRMLS_DC) { @@ -156,6 +158,9 @@ while (parent) { if (parent == U_CLASS_ENTRY(spl_ce_ArrayIterator) || parent == U_CLASS_ENTRY(spl_ce_RecursiveArrayIterator)) { retval.handlers = &spl_handler_ArrayIterator; +#if MBO_0 + class_type->get_iterator = spl_array_get_iterator; +#endif break; } else if (parent == U_CLASS_ENTRY(spl_ce_ArrayObject)) { retval.handlers = &spl_handler_ArrayObject; @@ -801,31 +806,6 @@ spl_array_it_rewind }; -zend_object_iterator *spl_array_obj_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */ -{ - zval *iterator = zend_user_it_new_iterator(ce, object TSRMLS_CC); - zend_object_iterator *new_iterator; - - zend_class_entry *ce_it = iterator && Z_TYPE_P(iterator) == IS_OBJECT ? Z_OBJCE_P(iterator) : NULL; - - if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && iterator == object)) { - if (!EG(exception)) - { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %v::getIterator() must be traversable or implement interface Iterator", ce->name); - } - if (iterator) - { - zval_ptr_dtor(&iterator); - } - return NULL; - } - - new_iterator = ce_it->get_iterator(ce_it, iterator, by_ref TSRMLS_CC); - zval_ptr_dtor(&iterator); - return new_iterator; -} -/* }}} */ - zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */ { spl_array_it *iterator; @@ -1467,7 +1447,6 @@ REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate); REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess); memcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - spl_ce_ArrayObject->get_iterator = spl_array_obj_get_iterator; spl_handler_ArrayObject.clone_obj = spl_array_object_clone; spl_handler_ArrayObject.read_dimension = spl_array_read_dimension;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php