mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Replace zval_dtor() with specialized destructors
This commit is contained in:
parent
0d235517a3
commit
b6fb584505
13 changed files with 45 additions and 43 deletions
|
@ -320,11 +320,11 @@ static UBool enumCharNames_callback(enumCharNames_data *context,
|
||||||
intl_error_set_code(NULL, U_INTERNAL_PROGRAM_ERROR);
|
intl_error_set_code(NULL, U_INTERNAL_PROGRAM_ERROR);
|
||||||
intl_error_set_custom_msg(NULL, "enumCharNames callback failed", 0);
|
intl_error_set_custom_msg(NULL, "enumCharNames callback failed", 0);
|
||||||
zval_dtor(&retval);
|
zval_dtor(&retval);
|
||||||
zval_dtor(&args[2]);
|
zval_ptr_dtor_str(&args[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
zval_dtor(&retval);
|
zval_dtor(&retval);
|
||||||
zval_dtor(&args[2]);
|
zval_ptr_dtor_str(&args[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
IC_METHOD(enumCharNames) {
|
IC_METHOD(enumCharNames) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ mysqlnd_minfo_dump_plugin_stats(zval *el, void * argument)
|
||||||
php_info_print_table_header(2, buf, "");
|
php_info_print_table_header(2, buf, "");
|
||||||
mysqlnd_minfo_print_hash(&values);
|
mysqlnd_minfo_print_hash(&values);
|
||||||
php_info_print_table_end();
|
php_info_print_table_end();
|
||||||
zval_dtor(&values);
|
zend_array_destroy(Z_ARR(values));
|
||||||
}
|
}
|
||||||
return ZEND_HASH_APPLY_KEEP;
|
return ZEND_HASH_APPLY_KEEP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
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);
|
fetch_value(stmt, &val, colno, NULL);
|
||||||
res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL;
|
res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL;
|
||||||
zval_dtor(&val);
|
zval_ptr_dtor_nogc(&val);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
if (Z_TYPE_P(param) != IS_STRING) {
|
||||||
zval_dtor(&data);
|
zval_ptr_dtor_str(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isc_close_blob(H->isc_status, &h)) {
|
if (isc_close_blob(H->isc_status, &h)) {
|
||||||
|
|
|
@ -1637,14 +1637,14 @@ static int phar_open_from_fp(php_stream* fp, char *fname, size_t fname_len, char
|
||||||
err = 1;
|
err = 1;
|
||||||
add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS);
|
add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS);
|
||||||
filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp));
|
filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp));
|
||||||
zval_dtor(&filterparams);
|
zend_array_destroy(Z_ARR(filterparams));
|
||||||
|
|
||||||
if (!filter) {
|
if (!filter) {
|
||||||
php_stream_close(temp);
|
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")
|
MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zval_dtor(&filterparams);
|
zend_array_destroy(Z_ARR(filterparams));
|
||||||
}
|
}
|
||||||
|
|
||||||
php_stream_filter_append(&temp->writefilters, filter);
|
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);
|
array_init(&filterparams);
|
||||||
add_assoc_long(&filterparams, "window", MAX_WBITS+16);
|
add_assoc_long(&filterparams, "window", MAX_WBITS+16);
|
||||||
filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp));
|
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 (!filter) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
|
@ -1320,7 +1320,7 @@ nostub:
|
||||||
#endif
|
#endif
|
||||||
add_assoc_long(&filterparams, "window", MAX_WBITS + 16);
|
add_assoc_long(&filterparams, "window", MAX_WBITS + 16);
|
||||||
filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp));
|
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 (!filter) {
|
||||||
/* copy contents uncompressed rather than lose them */
|
/* copy contents uncompressed rather than lose them */
|
||||||
|
|
|
@ -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])) {
|
if ((size_t)end != Z_STRLEN(zp[0])) {
|
||||||
zval_dtor(&zp[0]);
|
zval_ptr_dtor_str(&zp[0]);
|
||||||
zval_dtor(&zp[1]);
|
zval_ptr_dtor_str(&zp[1]);
|
||||||
zval_dtor(&zp[2]);
|
zval_ptr_dtor_str(&zp[2]);
|
||||||
zval_dtor(&openssl);
|
zval_ptr_dtor_str(&openssl);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILURE == zend_fcall_info_init(&openssl, 0, &fci, &fcc, NULL, NULL)) {
|
if (FAILURE == zend_fcall_info_init(&openssl, 0, &fci, &fcc, NULL, NULL)) {
|
||||||
zval_dtor(&zp[0]);
|
zval_ptr_dtor_str(&zp[0]);
|
||||||
zval_dtor(&zp[1]);
|
zval_ptr_dtor_str(&zp[1]);
|
||||||
zval_dtor(&zp[2]);
|
zval_ptr_dtor_str(&zp[2]);
|
||||||
zval_dtor(&openssl);
|
zval_ptr_dtor_str(&openssl);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1432,14 +1432,14 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t
|
||||||
fci.retval = &retval;
|
fci.retval = &retval;
|
||||||
|
|
||||||
if (FAILURE == zend_call_function(&fci, &fcc)) {
|
if (FAILURE == zend_call_function(&fci, &fcc)) {
|
||||||
zval_dtor(&zp[0]);
|
zval_ptr_dtor_str(&zp[0]);
|
||||||
zval_dtor(&zp[1]);
|
zval_ptr_dtor(&zp[1]);
|
||||||
zval_dtor(&zp[2]);
|
zval_ptr_dtor_str(&zp[2]);
|
||||||
zval_dtor(&openssl);
|
zval_ptr_dtor_str(&openssl);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
zval_dtor(&openssl);
|
zval_ptr_dtor_str(&openssl);
|
||||||
Z_DELREF(zp[0]);
|
Z_DELREF(zp[0]);
|
||||||
|
|
||||||
if (is_sign) {
|
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]);
|
Z_DELREF(zp[2]);
|
||||||
|
|
||||||
zval_dtor(&zp[0]);
|
zval_ptr_dtor_str(&zp[0]);
|
||||||
zval_dtor(&zp[2]);
|
zval_ptr_dtor_str(&zp[2]);
|
||||||
|
|
||||||
switch (Z_TYPE(retval)) {
|
switch (Z_TYPE(retval)) {
|
||||||
default:
|
default:
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
zval_dtor(&zp[1]);
|
zval_ptr_dtor(&zp[1]);
|
||||||
if (1 == Z_LVAL(retval)) {
|
if (1 == Z_LVAL(retval)) {
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1463,10 +1463,10 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t
|
||||||
case IS_TRUE:
|
case IS_TRUE:
|
||||||
*signature = estrndup(Z_STRVAL(zp[1]), Z_STRLEN(zp[1]));
|
*signature = estrndup(Z_STRVAL(zp[1]), Z_STRLEN(zp[1]));
|
||||||
*signature_len = Z_STRLEN(zp[1]);
|
*signature_len = Z_STRLEN(zp[1]);
|
||||||
zval_dtor(&zp[1]);
|
zval_ptr_dtor(&zp[1]);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
case IS_FALSE:
|
case IS_FALSE:
|
||||||
zval_dtor(&zp[1]);
|
zval_ptr_dtor(&zp[1]);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -971,7 +971,7 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo
|
||||||
xmlAddChild(ret, text);
|
xmlAddChild(ret, text);
|
||||||
efree(str);
|
efree(str);
|
||||||
if (data == &tmp) {
|
if (data == &tmp) {
|
||||||
zval_dtor(&tmp);
|
zval_ptr_dtor_str(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style == SOAP_ENCODED) {
|
if (style == SOAP_ENCODED) {
|
||||||
|
@ -3069,7 +3069,9 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
|
||||||
}
|
}
|
||||||
smart_str_free(&list);
|
smart_str_free(&list);
|
||||||
efree(str);
|
efree(str);
|
||||||
if (data == &tmp) {zval_dtor(&tmp);}
|
if (data == &tmp) {
|
||||||
|
zval_ptr_dtor_str(&tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1539,7 +1539,7 @@ PHP_METHOD(SoapServer, handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
zval_ptr_dtor(¶m);
|
zval_ptr_dtor(¶m);
|
||||||
zval_dtor(&readfile);
|
zval_ptr_dtor_str(&readfile);
|
||||||
zval_dtor(&readfile_ret);
|
zval_dtor(&readfile_ret);
|
||||||
|
|
||||||
SOAP_SERVER_END_CODE();
|
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 */
|
add_assoc_long_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */
|
||||||
|
|
||||||
zf = php_stream_filter_create("zlib.inflate", &filter_params, 0);
|
zf = php_stream_filter_create("zlib.inflate", &filter_params, 0);
|
||||||
zval_dtor(&filter_params);
|
zend_array_destroy(Z_ARR(filter_params));
|
||||||
|
|
||||||
if (zf) {
|
if (zf) {
|
||||||
php_stream_filter_append(&SG(request_info).request_body->readfilters, zf);
|
php_stream_filter_append(&SG(request_info).request_body->readfilters, zf);
|
||||||
|
@ -1698,12 +1698,12 @@ PHP_METHOD(SoapServer, handle)
|
||||||
if (EG(exception)) {
|
if (EG(exception)) {
|
||||||
php_output_discard();
|
php_output_discard();
|
||||||
_soap_server_exception(service, function, getThis());
|
_soap_server_exception(service, function, getThis());
|
||||||
zval_dtor(&constructor);
|
zval_ptr_dtor_str(&constructor);
|
||||||
zval_dtor(&c_ret);
|
zval_dtor(&c_ret);
|
||||||
zval_ptr_dtor(&tmp_soap);
|
zval_ptr_dtor(&tmp_soap);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
zval_dtor(&constructor);
|
zval_ptr_dtor_str(&constructor);
|
||||||
zval_dtor(&c_ret);
|
zval_dtor(&c_ret);
|
||||||
} else {
|
} else {
|
||||||
int class_name_len = ZSTR_LEN(service->soap_class.ce->name);
|
int class_name_len = ZSTR_LEN(service->soap_class.ce->name);
|
||||||
|
@ -1721,14 +1721,14 @@ PHP_METHOD(SoapServer, handle)
|
||||||
if (EG(exception)) {
|
if (EG(exception)) {
|
||||||
php_output_discard();
|
php_output_discard();
|
||||||
_soap_server_exception(service, function, getThis());
|
_soap_server_exception(service, function, getThis());
|
||||||
zval_dtor(&constructor);
|
zval_ptr_dtor_str(&constructor);
|
||||||
zval_dtor(&c_ret);
|
zval_dtor(&c_ret);
|
||||||
efree(class_name);
|
efree(class_name);
|
||||||
zval_ptr_dtor(&tmp_soap);
|
zval_ptr_dtor(&tmp_soap);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
zval_dtor(&constructor);
|
zval_ptr_dtor_str(&constructor);
|
||||||
zval_dtor(&c_ret);
|
zval_dtor(&c_ret);
|
||||||
}
|
}
|
||||||
efree(class_name);
|
efree(class_name);
|
||||||
|
@ -1952,7 +1952,7 @@ fail:
|
||||||
}
|
}
|
||||||
efree(h->parameters);
|
efree(h->parameters);
|
||||||
}
|
}
|
||||||
zval_dtor(&h->function_name);
|
zval_ptr_dtor_str(&h->function_name);
|
||||||
zval_dtor(&h->retval);
|
zval_dtor(&h->retval);
|
||||||
efree(h);
|
efree(h);
|
||||||
}
|
}
|
||||||
|
@ -1965,7 +1965,7 @@ fail:
|
||||||
}
|
}
|
||||||
efree(params);
|
efree(params);
|
||||||
}
|
}
|
||||||
zval_dtor(&function_name);
|
zval_ptr_dtor_str(&function_name);
|
||||||
|
|
||||||
SOAP_SERVER_END_CODE();
|
SOAP_SERVER_END_CODE();
|
||||||
}
|
}
|
||||||
|
|
|
@ -881,7 +881,7 @@ PHP_MINFO_FUNCTION(spl)
|
||||||
SPL_LIST_CLASSES(&list, 0, 1, ZEND_ACC_INTERFACE)
|
SPL_LIST_CLASSES(&list, 0, 1, ZEND_ACC_INTERFACE)
|
||||||
strg = estrdup("");
|
strg = estrdup("");
|
||||||
zend_hash_apply_with_argument(Z_ARRVAL_P(&list), (apply_func_arg_t)spl_build_class_list_string, &strg);
|
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);
|
php_info_print_table_row(2, "Interfaces", strg + 2);
|
||||||
efree(strg);
|
efree(strg);
|
||||||
|
|
||||||
|
@ -889,7 +889,7 @@ PHP_MINFO_FUNCTION(spl)
|
||||||
SPL_LIST_CLASSES(&list, 0, -1, ZEND_ACC_INTERFACE)
|
SPL_LIST_CLASSES(&list, 0, -1, ZEND_ACC_INTERFACE)
|
||||||
strg = estrdup("");
|
strg = estrdup("");
|
||||||
zend_hash_apply_with_argument(Z_ARRVAL_P(&list), (apply_func_arg_t)spl_build_class_list_string, &strg);
|
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);
|
php_info_print_table_row(2, "Classes", strg + 2);
|
||||||
efree(strg);
|
efree(strg);
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
if (Z_TYPE_P(find_hash) != IS_ARRAY) {
|
||||||
zval_dtor(find_hash);
|
zval_ptr_dtor_nogc(find_hash);
|
||||||
array_init(find_hash);
|
array_init(find_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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));
|
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;
|
numbytes = -1;
|
||||||
}
|
}
|
||||||
zval_dtor(&out);
|
zval_ptr_dtor_str(&out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_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>");
|
phpdbg_xml("</backtrace>");
|
||||||
|
|
||||||
zval_dtor(&zbacktrace);
|
zval_ptr_dtor_nogc(&zbacktrace);
|
||||||
zend_string_release(Z_STR(startfile));
|
zend_string_release(Z_STR(startfile));
|
||||||
|
|
||||||
PHPDBG_OUTPUT_BACKUP_RESTORE();
|
PHPDBG_OUTPUT_BACKUP_RESTORE();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue