helly Sun Oct 31 14:05:24 2004 EDT
Modified files:
/php-src/ext/spl spl_iterators.c
Log:
- Aggregate inner iterator for RecursiveIteratorIterator
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.45&r2=1.46&ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.45 php-src/ext/spl/spl_iterators.c:1.46
--- php-src/ext/spl/spl_iterators.c:1.45 Sun Oct 31 13:43:00 2004
+++ php-src/ext/spl/spl_iterators.c Sun Oct 31 14:05:19 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.45 2004/10/31 18:43:00 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.46 2004/10/31 19:05:19 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -445,6 +445,25 @@
RETURN_ZVAL(object->iterators[level].zobject, 1, 0);
} /* }}} */
+static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char
*method, int method_len TSRMLS_DC)
+{
+ union _zend_function *function_handler;
+ spl_recursive_it_object *object =
(spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
+ long level = object->level;
+ zval *zobj = object->iterators[level].zobject;
+
+ function_handler = std_object_handlers.get_method(object_ptr, method,
method_len TSRMLS_CC);
+ if (!function_handler) {
+ if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method,
method_len+1, (void **) &function_handler) == FAILURE) {
+ if (Z_OBJ_HT_P(zobj)->get_method) {
+ *object_ptr = zobj;
+ function_handler =
Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC);
+ }
+ }
+ }
+ return function_handler;
+}
+
/* {{{ spl_RecursiveIteratorIterator_dtor */
static void spl_RecursiveIteratorIterator_free_storage(void *_object TSRMLS_DC)
{
@@ -1503,6 +1522,7 @@
REGISTER_SPL_ITERATOR(RecursiveIteratorIterator);
memcpy(&spl_handlers_rec_it_it, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
+ spl_handlers_rec_it_it.get_method = spl_recursive_it_get_method;
spl_handlers_rec_it_it.clone_obj = NULL;
memcpy(&spl_handlers_dual_it, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php