summaryrefslogtreecommitdiff
path: root/ext/simplexml/simplexml.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-06-12 12:33:23 +0300
committerDmitry Stogov <dmitry@zend.com>2015-06-12 12:33:23 +0300
commit8e10e8f921101e0787c8228d257107a204de3e36 (patch)
tree35bad438a9a49a94a7f0b1e061538e03a49e2b78 /ext/simplexml/simplexml.c
parent730d7b8fcad30addc80d685e046b5f05bb3d0190 (diff)
downloadphp-git-8e10e8f921101e0787c8228d257107a204de3e36.tar.gz
Avoid zval duplication in ZVAL_ZVAL() macro (it was necessary only in few places).
Switch from ZVAL_ZVAL() to simpler macros where possible (it makes sense to review remaining places)
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r--ext/simplexml/simplexml.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 2d9e6fd339..9beb946aea 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1930,12 +1930,8 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type)
Returns the string content */
SXE_METHOD(__toString)
{
- zval result;
-
- if (sxe_object_cast_ex(getThis(), &result, IS_STRING) == SUCCESS) {
- RETURN_ZVAL(&result, 0, 0);
- } else {
- zval_ptr_dtor(&result);
+ if (sxe_object_cast_ex(getThis(), return_value, IS_STRING) != SUCCESS) {
+ zval_ptr_dtor(return_value);
RETURN_EMPTY_STRING();
}
}
@@ -1979,9 +1975,9 @@ static int sxe_count_elements(zval *object, zend_long *count) /* {{{ */
if (!Z_ISUNDEF(intern->tmp)) {
zval_ptr_dtor(&intern->tmp);
}
- ZVAL_ZVAL(&intern->tmp, &rv, 0, 0);
- convert_to_long(&intern->tmp);
- *count = (zend_long)Z_LVAL(intern->tmp);
+ ZVAL_LONG(&intern->tmp, zval_get_long(&rv));
+ zval_ptr_dtor(&rv);
+ *count = Z_LVAL(intern->tmp);
return SUCCESS;
}
return FAILURE;