com php-src: Use Z_ARRVAL_P since we already know it's an array: ext/json/json_encoder.c
| From: | Xinchen Hui | Date: | Wed, 06 May 2015 03:10:33 +0000 |
| Subject: | com php-src: Use Z_ARRVAL_P since we already know it's an array: ext/json/json_encoder.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86615@lists.php.net to get a copy of this message | ||
Commit: 9f0dbdf6c882e476bbad1fe8d42ef7c39362f3fa
Author: Xinchen Hui <laruence@php.net> Wed, 6 May 2015 11:10:33 +0800
Parents: c7345873032916d5ba4bd6a51a1aaf27d9a1fa5f
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9f0dbdf6c882e476bbad1fe8d42ef7c39362f3fa
Log:
Use Z_ARRVAL_P since we already know it's an array
Changed paths:
M ext/json/json_encoder.c
Diff:
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c
index 11630c9..d9bfb16 100644
--- a/ext/json/json_encoder.c
+++ b/ext/json/json_encoder.c
@@ -46,7 +46,7 @@ static void php_json_escape_string(smart_str *buf, char *s, size_t len, int opti
static int php_json_determine_array_type(zval *val) /* {{{ */
{
int i;
- HashTable *myht = HASH_OF(val);
+ HashTable *myht = Z_ARRVAL_P(val);
i = myht ? zend_hash_num_elements(myht) : 0;
if (i > 0) {
@@ -121,7 +121,7 @@ static void php_json_encode_array(smart_str *buf, zval *val, int options) /* {{{
HashTable *myht;
if (Z_TYPE_P(val) == IS_ARRAY) {
- myht = HASH_OF(val);
+ myht = Z_ARRVAL_P(val);
r = (options & PHP_JSON_FORCE_OBJECT) ? PHP_JSON_OUTPUT_OBJECT :
php_json_determine_array_type(val);
} else {
myht = Z_OBJPROP_P(val);
@@ -450,7 +450,7 @@ static void php_json_encode_serializable_object(smart_str *buf, zval *val, int o
HashTable* myht;
if (Z_TYPE_P(val) == IS_ARRAY) {
- myht = HASH_OF(val);
+ myht = Z_ARRVAL_P(val);
} else {
myht = Z_OBJPROP_P(val);
}