summaryrefslogtreecommitdiff
path: root/ext/spl/spl_sxe.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2005-10-03 16:05:08 (GMT)
committerMarcus Boerger <helly@php.net>2005-10-03 16:05:08 (GMT)
commit308a64bc08a9c1f39619e83d9d6c502dd3edfdb8 (patch)
tree1d34ac7d2c66607aed6f58dfe1d60630ed422087 /ext/spl/spl_sxe.c
parent42728f947c0ced85812439b24159d5a0b75594b5 (diff)
downloadphp-308a64bc08a9c1f39619e83d9d6c502dd3edfdb8.tar.gz
- MFH Really allow SXE being shared by not using anything from it directly in SPL
Diffstat (limited to 'ext/spl/spl_sxe.c')
-rwxr-xr-xext/spl/spl_sxe.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/spl/spl_sxe.c b/ext/spl/spl_sxe.c
index 5a2cd7e..5cf7c22 100755
--- a/ext/spl/spl_sxe.c
+++ b/ext/spl/spl_sxe.c
@@ -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 @@ zend_class_entry *spl_ce_SimpleXMLIterator = NULL;
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, key) /* {{{ */
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 @@ static zend_function_entry spl_funcs_SimpleXMLIterator[] = {
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;