#define SXE_METHOD(func) PHP_METHOD(simplexml_element, func)
static php_sxe_object* php_sxe_object_new(zend_class_entry *ce TSRMLS_DC);
-static zend_object *php_sxe_register_object(php_sxe_object * TSRMLS_DC);
static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data TSRMLS_DC);
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data TSRMLS_DC);
static zval *sxe_get_value(zval *z TSRMLS_DC);
php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC);
- ZVAL_OBJ(value, php_sxe_register_object(subnode TSRMLS_CC));
+ ZVAL_OBJ(value, &subnode->zo);
}
/* }}} */
}
php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC);
- ZVAL_OBJ(value, php_sxe_register_object(subnode TSRMLS_CC));
+ ZVAL_OBJ(value, &subnode->zo);
/*zval_add_ref(value);*/
}
}
zend_object_std_init(&intern->zo, ce TSRMLS_CC);
object_properties_init(&intern->zo, ce);
+ intern->zo.handlers = &sxe_object_handlers;
while (parent) {
if (parent == sxe_class_entry) {
}
/* }}} */
-/* {{{ php_sxe_register_object
- */
-static zend_object *
-php_sxe_register_object(php_sxe_object *intern TSRMLS_DC)
-{
- zend_objects_store_put(&intern->zo TSRMLS_CC);
- intern->zo.handlers = &sxe_object_handlers;
- return &intern->zo;
-}
-/* }}} */
-
/* {{{ sxe_object_new()
*/
PHP_SXE_API zend_object *
php_sxe_object *intern;
intern = php_sxe_object_new(ce TSRMLS_CC);
- return php_sxe_register_object(intern TSRMLS_CC);
+ return &intern->zo;
}
/* }}} */
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC);
php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC);
- ZVAL_OBJ(return_value, php_sxe_register_object(sxe TSRMLS_CC));
+ ZVAL_OBJ(return_value, &sxe->zo);
}
/* }}} */
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp TSRMLS_CC);
php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL TSRMLS_CC);
- ZVAL_OBJ(return_value, php_sxe_register_object(sxe TSRMLS_CC));
+ ZVAL_OBJ(return_value, &sxe->zo);
}
/* }}} */
zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
}
iterator = emalloc(sizeof(php_sxe_iterator));
+ zend_iterator_init(&iterator->intern TSRMLS_CC);
ZVAL_COPY(&iterator->intern.data, object);
iterator->intern.funcs = &php_sxe_iterator_funcs;
if (!ZVAL_IS_UNDEF(&iterator->intern.data)) {
zval_ptr_dtor(&iterator->intern.data);
}
-
- efree(iterator);
}
/* }}} */
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, nodep->doc TSRMLS_CC);
php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, nodep, NULL TSRMLS_CC);
- ZVAL_OBJ(return_value, php_sxe_register_object(sxe TSRMLS_CC));
+ ZVAL_OBJ(return_value, &sxe->zo);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Nodetype to import");
RETVAL_NULL();