diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-07-05 13:32:39 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-07-05 13:32:39 +0300 |
commit | b6fb584505cfddcd20c9913e0931374a8ce33a3f (patch) | |
tree | cfcefd169332785b149b03ff3d80c88936a46051 | |
parent | 0d235517a36ea99c7fc1116e0dc90cba3c21a1f7 (diff) | |
download | php-git-b6fb584505cfddcd20c9913e0931374a8ce33a3f.tar.gz |
Replace zval_dtor() with specialized destructors
-rw-r--r-- | ext/intl/uchar/uchar.c | 4 | ||||
-rw-r--r-- | ext/mysqlnd/php_mysqlnd.c | 2 | ||||
-rw-r--r-- | ext/pdo/pdo_stmt.c | 4 | ||||
-rw-r--r-- | ext/pdo_firebird/firebird_statement.c | 2 | ||||
-rw-r--r-- | ext/phar/phar.c | 6 | ||||
-rw-r--r-- | ext/phar/tar.c | 2 | ||||
-rw-r--r-- | ext/phar/util.c | 36 | ||||
-rw-r--r-- | ext/soap/php_encoding.c | 6 | ||||
-rw-r--r-- | ext/soap/soap.c | 16 | ||||
-rw-r--r-- | ext/spl/php_spl.c | 4 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 2 | ||||
-rw-r--r-- | ext/standard/file.c | 2 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_frame.c | 2 |
13 files changed, 45 insertions, 43 deletions
diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c index 10bfbc25c1..b01018de44 100644 --- a/ext/intl/uchar/uchar.c +++ b/ext/intl/uchar/uchar.c @@ -320,11 +320,11 @@ static UBool enumCharNames_callback(enumCharNames_data *context, intl_error_set_code(NULL, U_INTERNAL_PROGRAM_ERROR); intl_error_set_custom_msg(NULL, "enumCharNames callback failed", 0); zval_dtor(&retval); - zval_dtor(&args[2]); + zval_ptr_dtor_str(&args[2]); return 0; } zval_dtor(&retval); - zval_dtor(&args[2]); + zval_ptr_dtor_str(&args[2]); return 1; } IC_METHOD(enumCharNames) { diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index 4757990f6a..53a85701d1 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -67,7 +67,7 @@ mysqlnd_minfo_dump_plugin_stats(zval *el, void * argument) php_info_print_table_header(2, buf, ""); mysqlnd_minfo_print_hash(&values); php_info_print_table_end(); - zval_dtor(&values); + zend_array_destroy(Z_ARR(values)); } return ZEND_HASH_APPLY_KEEP; } diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 5f198e15a2..a6b2bedc0b 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1180,7 +1180,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ } zend_hash_next_index_insert(Z_ARRVAL(grp), return_value); } - zval_dtor(&grp_val); + zval_ptr_dtor_str(&grp_val); } } @@ -2579,7 +2579,7 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c fetch_value(stmt, &val, colno, NULL); res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL; - zval_dtor(&val); + zval_ptr_dtor_nogc(&val); return res; } diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 1d962411b7..43f0067916 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -487,7 +487,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param) } if (Z_TYPE_P(param) != IS_STRING) { - zval_dtor(&data); + zval_ptr_dtor_str(&data); } if (isc_close_blob(H->isc_status, &h)) { diff --git a/ext/phar/phar.c b/ext/phar/phar.c index d0624bcc39..499eca457d 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1637,14 +1637,14 @@ static int phar_open_from_fp(php_stream* fp, char *fname, size_t fname_len, char err = 1; add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS); filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp)); - zval_dtor(&filterparams); + zend_array_destroy(Z_ARR(filterparams)); if (!filter) { php_stream_close(temp); MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6") } } else { - zval_dtor(&filterparams); + zend_array_destroy(Z_ARR(filterparams)); } php_stream_filter_append(&temp->writefilters, filter); @@ -3191,7 +3191,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv array_init(&filterparams); add_assoc_long(&filterparams, "window", MAX_WBITS+16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp)); - zval_dtor(&filterparams); + zend_array_destroy(Z_ARR(filterparams)); if (!filter) { if (error) { diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 4241298fe2..83e8fbcaff 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -1320,7 +1320,7 @@ nostub: #endif add_assoc_long(&filterparams, "window", MAX_WBITS + 16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp)); - zval_dtor(&filterparams); + zend_array_destroy(Z_ARR(filterparams)); if (!filter) { /* copy contents uncompressed rather than lose them */ diff --git a/ext/phar/util.c b/ext/phar/util.c index 7652846eca..2044e9e6a8 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -1404,18 +1404,18 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t } if ((size_t)end != Z_STRLEN(zp[0])) { - zval_dtor(&zp[0]); - zval_dtor(&zp[1]); - zval_dtor(&zp[2]); - zval_dtor(&openssl); + zval_ptr_dtor_str(&zp[0]); + zval_ptr_dtor_str(&zp[1]); + zval_ptr_dtor_str(&zp[2]); + zval_ptr_dtor_str(&openssl); return FAILURE; } if (FAILURE == zend_fcall_info_init(&openssl, 0, &fci, &fcc, NULL, NULL)) { - zval_dtor(&zp[0]); - zval_dtor(&zp[1]); - zval_dtor(&zp[2]); - zval_dtor(&openssl); + zval_ptr_dtor_str(&zp[0]); + zval_ptr_dtor_str(&zp[1]); + zval_ptr_dtor_str(&zp[2]); + zval_ptr_dtor_str(&openssl); return FAILURE; } @@ -1432,14 +1432,14 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t fci.retval = &retval; if (FAILURE == zend_call_function(&fci, &fcc)) { - zval_dtor(&zp[0]); - zval_dtor(&zp[1]); - zval_dtor(&zp[2]); - zval_dtor(&openssl); + zval_ptr_dtor_str(&zp[0]); + zval_ptr_dtor(&zp[1]); + zval_ptr_dtor_str(&zp[2]); + zval_ptr_dtor_str(&openssl); return FAILURE; } - zval_dtor(&openssl); + zval_ptr_dtor_str(&openssl); Z_DELREF(zp[0]); if (is_sign) { @@ -1449,13 +1449,13 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t } Z_DELREF(zp[2]); - zval_dtor(&zp[0]); - zval_dtor(&zp[2]); + zval_ptr_dtor_str(&zp[0]); + zval_ptr_dtor_str(&zp[2]); switch (Z_TYPE(retval)) { default: case IS_LONG: - zval_dtor(&zp[1]); + zval_ptr_dtor(&zp[1]); if (1 == Z_LVAL(retval)) { return SUCCESS; } @@ -1463,10 +1463,10 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t case IS_TRUE: *signature = estrndup(Z_STRVAL(zp[1]), Z_STRLEN(zp[1])); *signature_len = Z_STRLEN(zp[1]); - zval_dtor(&zp[1]); + zval_ptr_dtor(&zp[1]); return SUCCESS; case IS_FALSE: - zval_dtor(&zp[1]); + zval_ptr_dtor(&zp[1]); return FAILURE; } } diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index c2aaf36797..0962e40118 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -971,7 +971,7 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo xmlAddChild(ret, text); efree(str); if (data == &tmp) { - zval_dtor(&tmp); + zval_ptr_dtor_str(&tmp); } if (style == SOAP_ENCODED) { @@ -3069,7 +3069,9 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP } smart_str_free(&list); efree(str); - if (data == &tmp) {zval_dtor(&tmp);} + if (data == &tmp) { + zval_ptr_dtor_str(&tmp); + } } return ret; } diff --git a/ext/soap/soap.c b/ext/soap/soap.c index b089caa650..82a4f369ac 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1539,7 +1539,7 @@ PHP_METHOD(SoapServer, handle) } zval_ptr_dtor(¶m); - zval_dtor(&readfile); + zval_ptr_dtor_str(&readfile); zval_dtor(&readfile_ret); SOAP_SERVER_END_CODE(); @@ -1588,7 +1588,7 @@ PHP_METHOD(SoapServer, handle) add_assoc_long_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */ zf = php_stream_filter_create("zlib.inflate", &filter_params, 0); - zval_dtor(&filter_params); + zend_array_destroy(Z_ARR(filter_params)); if (zf) { php_stream_filter_append(&SG(request_info).request_body->readfilters, zf); @@ -1698,12 +1698,12 @@ PHP_METHOD(SoapServer, handle) if (EG(exception)) { php_output_discard(); _soap_server_exception(service, function, getThis()); - zval_dtor(&constructor); + zval_ptr_dtor_str(&constructor); zval_dtor(&c_ret); zval_ptr_dtor(&tmp_soap); goto fail; } - zval_dtor(&constructor); + zval_ptr_dtor_str(&constructor); zval_dtor(&c_ret); } else { int class_name_len = ZSTR_LEN(service->soap_class.ce->name); @@ -1721,14 +1721,14 @@ PHP_METHOD(SoapServer, handle) if (EG(exception)) { php_output_discard(); _soap_server_exception(service, function, getThis()); - zval_dtor(&constructor); + zval_ptr_dtor_str(&constructor); zval_dtor(&c_ret); efree(class_name); zval_ptr_dtor(&tmp_soap); goto fail; } - zval_dtor(&constructor); + zval_ptr_dtor_str(&constructor); zval_dtor(&c_ret); } efree(class_name); @@ -1952,7 +1952,7 @@ fail: } efree(h->parameters); } - zval_dtor(&h->function_name); + zval_ptr_dtor_str(&h->function_name); zval_dtor(&h->retval); efree(h); } @@ -1965,7 +1965,7 @@ fail: } efree(params); } - zval_dtor(&function_name); + zval_ptr_dtor_str(&function_name); SOAP_SERVER_END_CODE(); } diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 37d1ecfc7e..f3acd6dd3d 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -881,7 +881,7 @@ PHP_MINFO_FUNCTION(spl) SPL_LIST_CLASSES(&list, 0, 1, ZEND_ACC_INTERFACE) strg = estrdup(""); zend_hash_apply_with_argument(Z_ARRVAL_P(&list), (apply_func_arg_t)spl_build_class_list_string, &strg); - zval_dtor(&list); + zend_array_destroy(Z_ARR(list)); php_info_print_table_row(2, "Interfaces", strg + 2); efree(strg); @@ -889,7 +889,7 @@ PHP_MINFO_FUNCTION(spl) SPL_LIST_CLASSES(&list, 0, -1, ZEND_ACC_INTERFACE) strg = estrdup(""); zend_hash_apply_with_argument(Z_ARRVAL_P(&list), (apply_func_arg_t)spl_build_class_list_string, &strg); - zval_dtor(&list); + zend_array_destroy(Z_ARR(list)); php_info_print_table_row(2, "Classes", strg + 2); efree(strg); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 6af26434b8..7424c24e1e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5998,7 +5998,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal } if (Z_TYPE_P(find_hash) != IS_ARRAY) { - zval_dtor(find_hash); + zval_ptr_dtor_nogc(find_hash); array_init(find_hash); } diff --git a/ext/standard/file.c b/ext/standard/file.c index 5ed42dd2e5..9507ae5827 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -700,7 +700,7 @@ PHP_FUNCTION(file_put_contents) php_error_docref(NULL, E_WARNING, "Only "ZEND_LONG_FMT" of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); numbytes = -1; } - zval_dtor(&out); + zval_ptr_dtor_str(&out); break; } } diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c index 7cdedcb497..2065277dfe 100644 --- a/sapi/phpdbg/phpdbg_frame.c +++ b/sapi/phpdbg/phpdbg_frame.c @@ -314,7 +314,7 @@ void phpdbg_dump_backtrace(size_t num) /* {{{ */ phpdbg_writeln("frame", "id=\"%d\" symbol=\"{main}\" file=\"%s\" line=\"%d\"", "frame #%d: {main} at %s:%ld", i, Z_STRVAL_P(file), Z_LVAL_P(line)); phpdbg_xml("</backtrace>"); - zval_dtor(&zbacktrace); + zval_ptr_dtor_nogc(&zbacktrace); zend_string_release(Z_STR(startfile)); PHPDBG_OUTPUT_BACKUP_RESTORE(); |