summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_API.c19
-rw-r--r--Zend/zend_builtin_functions.c4
-rw-r--r--Zend/zend_vm_def.h4
-rw-r--r--Zend/zend_vm_execute.h144
-rw-r--r--ext/json/json_parser.tab.c11
-rw-r--r--ext/json/json_parser.tab.h6
-rw-r--r--ext/json/json_parser.y5
-rw-r--r--ext/sockets/conversions.c15
-rw-r--r--ext/sockets/multicast.c21
-rw-r--r--ext/spl/spl_array.c5
-rw-r--r--ext/spl/spl_dllist.c4
-rw-r--r--ext/spl/spl_fixedarray.c13
-rw-r--r--ext/spl/spl_heap.c4
-rw-r--r--ext/spl/spl_iterators.c16
-rw-r--r--ext/wddx/wddx.c2
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c8
-rw-r--r--ext/xsl/xsltprocessor.c4
17 files changed, 118 insertions, 167 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 24734aa703..03a0df947e 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -80,9 +80,7 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array) /
}
while (param_count-->0) {
- if (Z_REFCOUNTED_P(param_ptr)) {
- Z_ADDREF_P(param_ptr);
- }
+ Z_TRY_ADDREF_P(param_ptr);
zend_hash_next_index_insert_new(Z_ARRVAL_P(argument_array), param_ptr);
param_ptr++;
}
@@ -1075,8 +1073,7 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */
zval *q = &CE_STATIC_MEMBERS(class_type->parent)[i];
ZVAL_NEW_REF(q, q);
- ZVAL_COPY_VALUE(&CE_STATIC_MEMBERS(class_type)[i], q);
- Z_ADDREF_P(q);
+ ZVAL_COPY(&CE_STATIC_MEMBERS(class_type)[i], q);
} else {
ZVAL_COPY_OR_DUP(&CE_STATIC_MEMBERS(class_type)[i], Z_REFVAL_P(p));
}
@@ -1627,9 +1624,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */
}
if (result) {
- if (Z_REFCOUNTED_P(result)) {
- Z_ADDREF_P(result);
- }
+ Z_TRY_ADDREF_P(result);
return SUCCESS;
} else {
return FAILURE;
@@ -2747,9 +2742,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_lengt
while (num_symbol_tables-- > 0) {
symbol_table = va_arg(symbol_table_list, HashTable *);
zend_hash_str_update(symbol_table, name, name_length, symbol);
- if (Z_REFCOUNTED_P(symbol)) {
- Z_ADDREF_P(symbol);
- }
+ Z_TRY_ADDREF_P(symbol);
}
va_end(symbol_table_list);
return SUCCESS;
@@ -3508,9 +3501,7 @@ ZEND_API int zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func,
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args), arg) {
if (func && !Z_ISREF_P(arg) && ARG_SHOULD_BE_SENT_BY_REF(func, n)) {
ZVAL_NEW_REF(params, arg);
- if (Z_REFCOUNTED_P(arg)) {
- Z_ADDREF_P(arg);
- }
+ Z_TRY_ADDREF_P(arg);
} else {
ZVAL_COPY(params, arg);
}
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 7190af97a4..baac19dda9 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -771,8 +771,8 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */
if (Z_REFCOUNTED_P(val)) {
copy_constant_array(new_val, val);
}
- } else if (Z_REFCOUNTED_P(val)) {
- Z_ADDREF_P(val);
+ } else {
+ Z_TRY_ADDREF_P(val);
}
} ZEND_HASH_FOREACH_END();
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 43e99271c3..1830720336 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2173,8 +2173,8 @@ ZEND_VM_C_LABEL(fast_assign_obj):
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (OP_DATA_TYPE == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (OP_DATA_TYPE == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 9c405e9054..80109fb1ec 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -18661,8 +18661,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -18815,8 +18815,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -18969,8 +18969,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -19123,8 +19123,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -22965,8 +22965,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -23119,8 +23119,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -23273,8 +23273,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -23427,8 +23427,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -25567,8 +25567,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -25721,8 +25721,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -25875,8 +25875,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -26029,8 +26029,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -27714,8 +27714,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -27868,8 +27868,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -28022,8 +28022,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -28176,8 +28176,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -30335,8 +30335,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -30489,8 +30489,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -30643,8 +30643,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -30797,8 +30797,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -32079,8 +32079,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -32233,8 +32233,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -32387,8 +32387,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -32541,8 +32541,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -36641,8 +36641,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -36795,8 +36795,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -36949,8 +36949,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -37103,8 +37103,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -43092,8 +43092,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -43246,8 +43246,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -43400,8 +43400,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -43554,8 +43554,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -46787,8 +46787,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CONST == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -46941,8 +46941,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_TMP_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -47095,8 +47095,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_VAR == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_VAR == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
@@ -47249,8 +47249,8 @@ fast_assign_obj:
value = Z_REFVAL_P(value);
Z_TRY_ADDREF_P(value);
}
- } else if (IS_CV == IS_CV && Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
+ } else if (IS_CV == IS_CV) {
+ Z_TRY_ADDREF_P(value);
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
diff --git a/ext/json/json_parser.tab.c b/ext/json/json_parser.tab.c
index 5db1842900..2edcc63703 100644
--- a/ext/json/json_parser.tab.c
+++ b/ext/json/json_parser.tab.c
@@ -139,8 +139,8 @@ int json_yydebug = 1;
/* In a future release of Bison, this section will be replaced
by #include "json_parser.tab.h". */
-#ifndef YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
-# define YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+#ifndef YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+# define YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -201,7 +201,7 @@ typedef union YYSTYPE YYSTYPE;
int php_json_yyparse (php_json_parser *parser);
-#endif /* !YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
+#endif /* !YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */
@@ -1892,10 +1892,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
}
ZVAL_NEW_STR(&zkey, key);
zend_std_write_property(object, &zkey, zvalue, NULL);
-
- if (Z_REFCOUNTED_P(zvalue)) {
- Z_DELREF_P(zvalue);
- }
+ Z_TRY_DELREF_P(zvalue);
}
zend_string_release(key);
diff --git a/ext/json/json_parser.tab.h b/ext/json/json_parser.tab.h
index 4349b70406..3f126dc9c7 100644
--- a/ext/json/json_parser.tab.h
+++ b/ext/json/json_parser.tab.h
@@ -30,8 +30,8 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
-#ifndef YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
-# define YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+#ifndef YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
+# define YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -92,4 +92,4 @@ typedef union YYSTYPE YYSTYPE;
int php_json_yyparse (php_json_parser *parser);
-#endif /* !YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
+#endif /* !YY_PHP_JSON_YY_HOME_HUIXINCHEN_OPENSOURCE_TRUNK_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y
index 9b9df983ad..ddac27373b 100644
--- a/ext/json/json_parser.y
+++ b/ext/json/json_parser.y
@@ -284,10 +284,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
}
ZVAL_NEW_STR(&zkey, key);
zend_std_write_property(object, &zkey, zvalue, NULL);
-
- if (Z_REFCOUNTED_P(zvalue)) {
- Z_DELREF_P(zvalue);
- }
+ Z_TRY_DELREF_P(zvalue);
}
zend_string_release(key);
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c
index 093b6c5d72..4a1705bcee 100644
--- a/ext/sockets/conversions.c
+++ b/ext/sockets/conversions.c
@@ -1076,18 +1076,15 @@ static void from_zval_write_iov_array_aux(zval *elem, unsigned i, void **args, s
{
struct msghdr *msg = args[0];
size_t len;
+ zend_string *str;
- if (Z_REFCOUNTED_P(elem)) {
- Z_ADDREF_P(elem);
- }
- convert_to_string_ex(elem);
+ str = zval_get_string(elem);
- len = Z_STRLEN_P(elem);
- msg->msg_iov[i - 1].iov_base = accounted_emalloc(len, ctx);
- msg->msg_iov[i - 1].iov_len = len;
- memcpy(msg->msg_iov[i - 1].iov_base, Z_STRVAL_P(elem), len);
+ msg->msg_iov[i - 1].iov_base = accounted_emalloc(ZSTR_LEN(str), ctx);
+ msg->msg_iov[i - 1].iov_len = ZSTR_LEN(str);
+ memcpy(msg->msg_iov[i - 1].iov_base, ZSTR_VAL(str), ZSTR_LEN(str));
- zval_ptr_dtor(elem);
+ zend_string_release(str);
}
static void from_zval_write_iov_array(const zval *arr, char *msghdr_c, ser_context *ctx)
{
diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c
index 24f374c55d..9857be3982 100644
--- a/ext/sockets/multicast.c
+++ b/ext/sockets/multicast.c
@@ -100,12 +100,9 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out)
ret = SUCCESS;
}
} else {
- if (Z_REFCOUNTED_P(val)) {
- Z_ADDREF_P(val);
- }
- convert_to_string_ex(val);
- ret = php_string_to_if_index(Z_STRVAL_P(val), out);
- zval_ptr_dtor(val);
+ zend_string *str = zval_get_string(val);
+ ret = php_string_to_if_index(ZSTR_VAL(str), out);
+ zend_string_release(str);
}
return ret;
@@ -130,20 +127,18 @@ static int php_get_address_from_array(const HashTable *ht, const char *key,
php_socket *sock, php_sockaddr_storage *ss, socklen_t *ss_len)
{
zval *val;
+ zend_string *str;
if ((val = zend_hash_str_find(ht, key, strlen(key))) == NULL) {
php_error_docref(NULL, E_WARNING, "no key \"%s\" passed in optval", key);
return FAILURE;
}
- if (Z_REFCOUNTED_P(val)) {
- Z_ADDREF_P(val);
- }
- convert_to_string_ex(val);
- if (!php_set_inet46_addr(ss, ss_len, Z_STRVAL_P(val), sock)) {
- zval_ptr_dtor(val);
+ str = zval_get_string(val);
+ if (!php_set_inet46_addr(ss, ss_len, ZSTR_VAL(str), sock)) {
+ zend_string_release(str);
return FAILURE;
}
- zval_ptr_dtor(val);
+ zend_string_release(str);
return SUCCESS;
}
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index f1c49f4db4..a9645ec61d 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -473,10 +473,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
return;
}
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
-
+ Z_TRY_ADDREF_P(value);
if (!offset) {
ht = spl_array_get_hash_table(intern);
zend_hash_next_index_insert(ht, value);
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index fac5007be2..1f594293cd 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1248,9 +1248,7 @@ SPL_METHOD(SplDoublyLinkedList, add)
return;
}
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
+ Z_TRY_ADDREF_P(value);
if (index == intern->llist->count) {
/* If index is the last entry+1 then we do a push because we're not inserting before any entry */
spl_ptr_llist_push(intern->llist, value);
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 46e627102b..20fe02fd74 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -167,9 +167,7 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj) /* {{{{ */
for (i = 0; i < intern->array.size; i++) {
if (!Z_ISUNDEF(intern->array.elements[i])) {
zend_hash_index_update(ht, i, &intern->array.elements[i]);
- if (Z_REFCOUNTED(intern->array.elements[i])){
- Z_ADDREF(intern->array.elements[i]);
- }
+ Z_TRY_ADDREF(intern->array.elements[i]);
} else {
zend_hash_index_update(ht, i, &EG(uninitialized_zval));
}
@@ -595,10 +593,7 @@ SPL_METHOD(SplFixedArray, __wakeup)
spl_fixedarray_init(&intern->array, size);
ZEND_HASH_FOREACH_VAL(intern_ht, data) {
- if (Z_REFCOUNTED_P(data)) {
- Z_ADDREF_P(data);
- }
- ZVAL_COPY_VALUE(&intern->array.elements[index], data);
+ ZVAL_COPY(&intern->array.elements[index], data);
index++;
} ZEND_HASH_FOREACH_END();
@@ -644,9 +639,7 @@ SPL_METHOD(SplFixedArray, toArray)
for (; i < intern->array.size; i++) {
if (!Z_ISUNDEF(intern->array.elements[i])) {
zend_hash_index_update(Z_ARRVAL_P(return_value), i, &intern->array.elements[i]);
- if (Z_REFCOUNTED(intern->array.elements[i])) {
- Z_ADDREF(intern->array.elements[i]);
- }
+ Z_TRY_ADDREF(intern->array.elements[i]);
} else {
zend_hash_index_update(Z_ARRVAL_P(return_value), i, &EG(uninitialized_zval));
}
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index db8f8d9779..5fecbfd290 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -97,9 +97,7 @@ static void spl_ptr_heap_zval_dtor(zval *elem) { /* {{{ */
/* }}} */
static void spl_ptr_heap_zval_ctor(zval *elem) { /* {{{ */
- if (Z_REFCOUNTED_P(elem)) {
- Z_ADDREF_P(elem);
- }
+ Z_TRY_ADDREF_P(elem);
}
/* }}} */
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 41597e5f6b..e9975d0708 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1579,9 +1579,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
efree(cfi);
return NULL;
}
- if (Z_REFCOUNTED_P(&cfi->fci.function_name)) {
- Z_ADDREF(cfi->fci.function_name);
- }
+ Z_TRY_ADDREF(cfi->fci.function_name);
cfi->object = cfi->fcc.object;
if (cfi->object) GC_ADDREF(cfi->object);
intern->u.cbfilter = cfi;
@@ -2699,8 +2697,8 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
use_copy = zend_make_printable_zval(&intern->u.caching.zstr, &expr_copy);
if (use_copy) {
ZVAL_COPY_VALUE(&intern->u.caching.zstr, &expr_copy);
- } else if (Z_REFCOUNTED(intern->u.caching.zstr)) {
- Z_ADDREF(intern->u.caching.zstr);
+ } else {
+ Z_TRY_ADDREF(intern->u.caching.zstr);
}
}
spl_dual_it_next(intern, 0);
@@ -2830,9 +2828,7 @@ SPL_METHOD(CachingIterator, offsetSet)
return;
}
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
+ Z_TRY_ADDREF_P(value);
zend_symtable_update(Z_ARRVAL(intern->u.caching.zcache), key, value);
}
/* }}} */
@@ -3571,9 +3567,7 @@ static int spl_iterator_to_values_apply(zend_object_iterator *iter, void *puser)
if (data == NULL) {
return ZEND_HASH_APPLY_STOP;
}
- if (Z_REFCOUNTED_P(data)) {
- Z_ADDREF_P(data);
- }
+ Z_TRY_ADDREF_P(data);
add_next_index_zval(return_value, data);
return ZEND_HASH_APPLY_KEEP;
}
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 85b3a6438c..3b69d999df 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -991,7 +991,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
zval_ptr_dtor(&ent1->data);
} else if (Z_TYPE(ent2->data) == IS_OBJECT) {
zend_update_property(Z_OBJCE(ent2->data), &ent2->data, ent1->varname, strlen(ent1->varname), &ent1->data);
- if Z_REFCOUNTED(ent1->data) Z_DELREF(ent1->data);
+ Z_TRY_DELREF(ent1->data);
} else {
zend_symtable_str_update(target_hash, ent1->varname, strlen(ent1->varname), &ent1->data);
}
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index cb727da38c..2f6bae641d 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -981,9 +981,7 @@ PHP_FUNCTION(xmlrpc_server_register_method)
if (XMLRPC_ServerRegisterMethod(server->server_ptr, method_key, php_xmlrpc_callback)) {
/* save for later use */
- if (Z_REFCOUNTED_P(method_name)) {
- Z_ADDREF_P(method_name);
- }
+ Z_TRY_ADDREF_P(method_name);
/* register our php method */
add_zval(&server->method_map, method_key, method_name);
@@ -1007,9 +1005,7 @@ PHP_FUNCTION(xmlrpc_server_register_introspection_callback)
RETURN_FALSE;
}
- if (Z_REFCOUNTED_P(method_name)) {
- Z_ADDREF_P(method_name);
- }
+ Z_TRY_ADDREF_P(method_name);
/* register our php method */
add_zval(&server->introspection_map, NULL, method_name);
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 6fda147b5c..5fe6c61494 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -764,9 +764,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
RETURN_FALSE;
}
convert_to_string_ex(entry);
- if (Z_REFCOUNTED_P(entry)) {
- Z_ADDREF_P(entry);
- }
+ Z_TRY_ADDREF_P(entry);
zend_hash_update(intern->parameter, string_key, entry);
} ZEND_HASH_FOREACH_END();
RETURN_TRUE;