helly Mon Oct 3 12:04:51 2005 EDT
Modified files:
/php-src/ext/spl spl_sxe.c
/php-src/ext/simplexml php_simplexml_exports.h simplexml.c
Log:
- Really allow SXE being shared by not using anything from it directly in SPL
http://cvs.php.net/diff.php/php-src/ext/spl/spl_sxe.c?r1=1.12&r2=1.13&ty=u
Index: php-src/ext/spl/spl_sxe.c
diff -u php-src/ext/spl/spl_sxe.c:1.12 php-src/ext/spl/spl_sxe.c:1.13
--- php-src/ext/spl/spl_sxe.c:1.12 Sat Oct 1 11:55:27 2005
+++ php-src/ext/spl/spl_sxe.c Mon Oct 3 12:04:50 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_sxe.c,v 1.12 2005/10/01 15:55:27 helly Exp $ */
+/* $Id: spl_sxe.c,v 1.13 2005/10/03 16:04:50 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -34,6 +34,7 @@
#include "spl_sxe.h"
zend_class_entry *spl_ce_SimpleXMLIterator = NULL;
+zend_class_entry *spl_ce_SimpleXMLElement;
#if HAVE_LIBXML && HAVE_SIMPLEXML
@@ -41,9 +42,10 @@
SPL_METHOD(SimpleXMLIterator, rewind) /* {{{ */
{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+ php_sxe_iterator iter;
- php_sxe_reset_iterator(sxe TSRMLS_CC);
+ iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+
spl_ce_SimpleXMLElement->iterator_funcs.funcs->rewind((zend_object_iterator*)&iter
TSRMLS_CC);
}
/* }}} */
@@ -89,9 +91,10 @@
SPL_METHOD(SimpleXMLIterator, next) /* {{{ */
{
- php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+ php_sxe_iterator iter;
- php_sxe_move_forward_iterator(sxe TSRMLS_CC);
+ iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
+
spl_ce_SimpleXMLElement->iterator_funcs.funcs->move_forward((zend_object_iterator*)&iter
TSRMLS_CC);
}
/* }}} */
@@ -146,16 +149,17 @@
SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */
{
- zend_class_entry **pce, *spl_ce_SimpleXMLElement;
+ zend_class_entry **pce;
if (zend_hash_find(CG(class_table), "simplexmlelement",
sizeof("SimpleXMLElement"), (void **) &pce) == FAILURE) {
+ spl_ce_SimpleXMLElement = NULL;
spl_ce_SimpleXMLIterator = NULL;
return SUCCESS; /* SimpleXML must be initialized before */
}
spl_ce_SimpleXMLElement = *pce;
- REGISTER_SPL_SUB_CLASS_EX(SimpleXMLIterator, SimpleXMLElement,
sxe_object_new, spl_funcs_SimpleXMLIterator);
+ REGISTER_SPL_SUB_CLASS_EX(SimpleXMLIterator, SimpleXMLElement,
spl_ce_SimpleXMLElement->create_object, spl_funcs_SimpleXMLIterator);
REGISTER_SPL_IMPLEMENTS(SimpleXMLIterator, RecursiveIterator);
return SUCCESS;
http://cvs.php.net/diff.php/php-src/ext/simplexml/php_simplexml_exports.h?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/simplexml/php_simplexml_exports.h
diff -u php-src/ext/simplexml/php_simplexml_exports.h:1.3
php-src/ext/simplexml/php_simplexml_exports.h:1.4
--- php-src/ext/simplexml/php_simplexml_exports.h:1.3 Wed Aug 3 10:07:45 2005
+++ php-src/ext/simplexml/php_simplexml_exports.h Mon Oct 3 12:04:50 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_simplexml_exports.h,v 1.3 2005/08/03 14:07:45 sniper Exp $ */
+/* $Id: php_simplexml_exports.h,v 1.4 2005/10/03 16:04:50 helly Exp $ */
#ifndef PHP_SIMPLEXML_EXPORTS_H
#define PHP_SIMPLEXML_EXPORTS_H
@@ -52,6 +52,11 @@
ZEND_API void php_sxe_reset_iterator(php_sxe_object *sxe TSRMLS_DC);
ZEND_API void php_sxe_move_forward_iterator(php_sxe_object *sxe TSRMLS_DC);
+typedef struct {
+ zend_object_iterator intern;
+ php_sxe_object *sxe;
+} php_sxe_iterator;
+
#endif /* PHP_SIMPLEXML_EXPORTS_H */
/**
http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.160&r2=1.161&ty=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.160
php-src/ext/simplexml/simplexml.c:1.161
--- php-src/ext/simplexml/simplexml.c:1.160 Thu Sep 15 12:19:45 2005
+++ php-src/ext/simplexml/simplexml.c Mon Oct 3 12:04:50 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.160 2005/09/15 16:19:45 derick Exp $ */
+/* $Id: simplexml.c,v 1.161 2005/10/03 16:04:50 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1401,11 +1401,6 @@
/* }}} */
-typedef struct {
- zend_object_iterator intern;
- php_sxe_object *sxe;
-} php_sxe_iterator;
-
static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC);
static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC);
static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval
***data TSRMLS_DC);
@@ -1731,6 +1726,7 @@
sxe.create_object = sxe_object_new;
sxe_class_entry = zend_register_internal_class(&sxe TSRMLS_CC);
sxe_class_entry->get_iterator = php_sxe_get_iterator;
+ sxe_class_entry->iterator_funcs.funcs = &php_sxe_iterator_funcs;
zend_class_implements(sxe_class_entry TSRMLS_CC, 1,
zend_ce_traversable);
sxe_object_handlers.get_method =
zend_get_std_object_handlers()->get_method;
sxe_object_handlers.get_constructor =
zend_get_std_object_handlers()->get_constructor;
@@ -1769,7 +1765,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.160 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.161 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php