Skip to content

Commit a975c7e

Browse files
committed
Refactor simpleXML (compilable, but incompleted)
1 parent b178992 commit a975c7e

File tree

5 files changed

+219
-261
lines changed

5 files changed

+219
-261
lines changed

ext/libxml/php_libxml.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ typedef struct _php_libxml_node_ptr {
7575
} php_libxml_node_ptr;
7676

7777
typedef struct _php_libxml_node_object {
78-
zend_object std;
7978
php_libxml_node_ptr *node;
8079
php_libxml_ref_obj *document;
8180
HashTable *properties;
81+
zend_object std;
8282
} php_libxml_node_object;
8383

8484
typedef void * (*php_libxml_export_node) (zval *object TSRMLS_DC);

ext/simplexml/php_simplexml.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ typedef enum {
5555
} SXE_ITER;
5656

5757
typedef struct {
58-
zend_object zo;
5958
php_libxml_node_ptr *node;
6059
php_libxml_ref_obj *document;
6160
HashTable *properties;
@@ -65,10 +64,11 @@ typedef struct {
6564
xmlChar *nsprefix;
6665
int isprefix;
6766
SXE_ITER type;
68-
zval *data;
67+
zval data;
6968
} iter;
70-
zval *tmp;
69+
zval tmp;
7170
zend_function *fptr_count;
71+
zend_object zo;
7272
} php_sxe_object;
7373

7474
#ifdef ZTS

ext/simplexml/php_simplexml_exports.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@
3939
} \
4040
}
4141

42-
PHP_SXE_API zend_object_value sxe_object_new(zend_class_entry *ce TSRMLS_DC);
43-
/* {{{ php_sxe_fetch_object()
44-
*/
45-
static inline php_sxe_object *
46-
php_sxe_fetch_object(zval *object TSRMLS_DC)
47-
{
48-
return (php_sxe_object *) zend_object_store_get_object(object TSRMLS_CC);
42+
PHP_SXE_API zend_object *sxe_object_new(zend_class_entry *ce TSRMLS_DC);
43+
44+
static inline php_sxe_object *php_sxe_fetch_object(zend_object *obj) /* {{{ */ {
45+
return (php_sxe_object *)((char*)(obj) - XtOffsetOf(php_sxe_object, zo));
4946
}
5047
/* }}} */
5148

49+
#define Z_SXEOBJ_P(zv) php_sxe_fetch_object(Z_OBJ_P((zv)))
50+
5251
typedef struct {
5352
zend_object_iterator intern;
5453
php_sxe_object *sxe;

0 commit comments

Comments
 (0)