diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-17 12:34:04 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-17 16:36:56 +0200 |
| commit | 15846ff115722b2f95d699abf07141d774b0e2cd (patch) | |
| tree | 0be3155ce95856e82c4a0cf4c694ab0c6df49e62 /ext/simplexml/simplexml.c | |
| parent | b516566b84c210ce6ceddeb238e45d4b1bcb32ce (diff) | |
| download | php-git-15846ff115722b2f95d699abf07141d774b0e2cd.tar.gz | |
Add ZVAL_OBJ_COPY macro
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
Diffstat (limited to 'ext/simplexml/simplexml.c')
| -rw-r--r-- | ext/simplexml/simplexml.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 85372cb53d..20e20e3a2b 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -2216,7 +2216,7 @@ PHP_FUNCTION(simplexml_load_file) php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp); php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL); - ZVAL_OBJ(return_value, &sxe->zo); + RETURN_OBJ(&sxe->zo); } /* }}} */ @@ -2270,7 +2270,7 @@ PHP_FUNCTION(simplexml_load_string) php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp); php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL); - ZVAL_OBJ(return_value, &sxe->zo); + RETURN_OBJ(&sxe->zo); } /* }}} */ @@ -2419,8 +2419,7 @@ zend_object_iterator *php_sxe_get_iterator(zend_class_entry *ce, zval *object, i iterator = emalloc(sizeof(php_sxe_iterator)); zend_iterator_init(&iterator->intern); - Z_ADDREF_P(object); - ZVAL_OBJ(&iterator->intern.data, Z_OBJ_P(object)); + ZVAL_OBJ_COPY(&iterator->intern.data, Z_OBJ_P(object)); iterator->intern.funcs = &php_sxe_iterator_funcs; iterator->sxe = Z_SXEOBJ_P(object); @@ -2568,7 +2567,7 @@ PHP_FUNCTION(simplexml_import_dom) php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, nodep->doc); php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, nodep, NULL); - ZVAL_OBJ(return_value, &sxe->zo); + RETURN_OBJ(&sxe->zo); } else { php_error_docref(NULL, E_WARNING, "Invalid Nodetype to import"); RETVAL_NULL(); |
