diff options
author | Nikita Popov <nikic@php.net> | 2014-04-21 17:51:15 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2014-04-21 17:55:58 +0200 |
commit | 0d43a277b8dec6ea9f804eeb1a68c05047a22c4f (patch) | |
tree | f65e912985906605e7fc493067bfcbba33f05962 /ext/reflection | |
parent | bda96e3c589b2b923e70abd4a5e66dfa824e8f5d (diff) | |
download | php-git-0d43a277b8dec6ea9f804eeb1a68c05047a22c4f.tar.gz |
Use zval_get_string in a few more places
Diffstat (limited to 'ext/reflection')
-rw-r--r-- | ext/reflection/php_reflection.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 86391115d0..b78311868a 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -655,23 +655,13 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in /* {{{ _const_string */ static void _const_string(string *str, char *name, zval *value, char *indent TSRMLS_DC) { - char *type; - zval value_copy; - int use_copy; - - type = zend_zval_type_name(value); - - zend_make_printable_zval(value, &value_copy, &use_copy); - if (use_copy) { - value = &value_copy; - } + char *type = zend_zval_type_name(value); + zend_string *value_str = zval_get_string(value TSRMLS_CC); string_printf(str, "%s Constant [ %s %s ] { %s }\n", - indent, type, name, Z_STRVAL_P(value)); + indent, type, name, value_str->val); - if (use_copy) { - zval_dtor(value); - } + STR_RELEASE(value_str); } /* }}} */ @@ -728,8 +718,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg if (fptr->type == ZEND_USER_FUNCTION && offset >= required) { zend_op *precv = _get_recv_op((zend_op_array*)fptr, offset); if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) { - zval zv, zv_copy; - int use_copy; + zval zv; string_write(str, " = ", sizeof(" = ")-1); ZVAL_DUP(&zv, precv->op2.zv); zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC); @@ -751,11 +740,9 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg } else if (Z_TYPE(zv) == IS_ARRAY) { string_write(str, "Array", sizeof("Array")-1); } else { - zend_make_printable_zval(&zv, &zv_copy, &use_copy); - string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); - if (use_copy) { - zval_dtor(&zv_copy); - } + zend_string *zv_str = zval_get_string(&zv); + string_write(str, zv_str->val, zv_str->len); + STR_RELEASE(zv_str); } zval_ptr_dtor(&zv); } |