From: Dmitry Stogov Date: Tue, 18 Feb 2014 12:44:01 +0000 (+0400) Subject: Use better data structures (incomplete) X-Git-Tag: POST_PHPNG_MERGE~412^2~629 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7428cac6e8d1d7aca3e156def8f13e184ebd0c35;p=php Use better data structures (incomplete) --- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 85c52dd953..5e7669e746 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -376,7 +376,7 @@ ZEND_FUNCTION(gc_enable) { zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); zend_alter_ini_entry(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - STR_FREE(key); + STR_RELEASE(key); } /* }}} */ @@ -386,7 +386,7 @@ ZEND_FUNCTION(gc_disable) { zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - STR_FREE(key); + STR_RELEASE(key); } /* }}} */ @@ -639,7 +639,7 @@ ZEND_FUNCTION(error_reporting) if(ZEND_NUM_ARGS() != 0) { zend_string *key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0); zend_alter_ini_entry(key, err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - STR_FREE(key); + STR_RELEASE(key); } RETVAL_LONG(old_error_reporting); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 76504eb4d0..c50e9b9380 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5334,7 +5334,7 @@ PHP_FUNCTION(ini_get) return; } - str = zend_ini_string(varname, varname_len + 1, 0); + str = zend_ini_string(varname, varname_len, 0); if (!str) { RETURN_FALSE; @@ -5510,11 +5510,11 @@ PHP_FUNCTION(set_include_path) key = STR_INIT("include_path", sizeof("include_path")-1, 0); if (zend_alter_ini_entry_ex(key, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) { - STR_FREE(key); + STR_RELEASE(key); zval_dtor(return_value); RETURN_FALSE; } - STR_FREE(key); + STR_RELEASE(key); } /* }}} */ @@ -5612,7 +5612,7 @@ PHP_FUNCTION(ignore_user_abort) if (arg) { zend_string *key = STR_INIT("ignore_user_abort", sizeof("ignore_user_abort"), 0); zend_alter_ini_entry_ex(key, arg, arg_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); - STR_FREE(key); + STR_RELEASE(key); } RETURN_LONG(old_setting); diff --git a/main/SAPI.c b/main/SAPI.c index d9f55a58be..4f61e3a93c 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -798,7 +798,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) if (!strncmp(ptr, "image/", sizeof("image/")-1)) { zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_FREE(key); + STR_RELEASE(key); } mimetype = estrdup(ptr); @@ -827,7 +827,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_FREE(key); + STR_RELEASE(key); } else if (!STRCASECMP(header_line, "Location")) { if ((SG(sapi_headers).http_response_code < 300 || SG(sapi_headers).http_response_code > 307) && diff --git a/main/main.c b/main/main.c index b2068cd137..9d6fe67755 100644 --- a/main/main.c +++ b/main/main.c @@ -1287,7 +1287,7 @@ PHP_FUNCTION(set_time_limit) } else { RETVAL_FALSE; } - STR_FREE(key); + STR_RELEASE(key); efree(new_timeout_str); } /* }}} */