mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Use alloca() for temporary allocation
This commit is contained in:
parent
fd24614cd9
commit
acd77dec81
1 changed files with 13 additions and 7 deletions
|
@ -2836,6 +2836,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
zend_class_entry *last_scope;
|
zend_class_entry *last_scope;
|
||||||
HashTable *ftable;
|
HashTable *ftable;
|
||||||
int call_via_handler = 0;
|
int call_via_handler = 0;
|
||||||
|
ALLOCA_FLAG(use_heap)
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
*error = NULL;
|
*error = NULL;
|
||||||
|
@ -2845,22 +2846,27 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||||
fcc->function_handler = NULL;
|
fcc->function_handler = NULL;
|
||||||
|
|
||||||
if (!ce_org) {
|
if (!ce_org) {
|
||||||
|
char *lmname;
|
||||||
|
int lmname_len;
|
||||||
|
|
||||||
/* Skip leading \ */
|
/* Skip leading \ */
|
||||||
if (Z_STRVAL_P(callable)[0] == '\\') {
|
if (Z_STRVAL_P(callable)[0] == '\\') {
|
||||||
lmname = STR_ALLOC(Z_STRLEN_P(callable) - 1, 0);
|
lmname = do_alloca(Z_STRLEN_P(callable) - 1, use_heap);
|
||||||
zend_str_tolower_copy(lmname->val, Z_STRVAL_P(callable) + 1, Z_STRLEN_P(callable) - 1);
|
lmname_len = Z_STRLEN_P(callable) - 1;
|
||||||
|
zend_str_tolower_copy(lmname, Z_STRVAL_P(callable) + 1, lmname_len);
|
||||||
} else {
|
} else {
|
||||||
lmname = STR_ALLOC(Z_STRLEN_P(callable), 0);
|
lmname = do_alloca(Z_STRLEN_P(callable), use_heap);
|
||||||
zend_str_tolower_copy(lmname->val, Z_STRVAL_P(callable), Z_STRLEN_P(callable));
|
lmname_len = Z_STRLEN_P(callable);
|
||||||
|
zend_str_tolower_copy(lmname, Z_STRVAL_P(callable), lmname_len);
|
||||||
}
|
}
|
||||||
/* Check if function with given name exists.
|
/* Check if function with given name exists.
|
||||||
* This may be a compound name that includes namespace name */
|
* This may be a compound name that includes namespace name */
|
||||||
fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname);
|
fcc->function_handler = zend_hash_str_find_ptr(EG(function_table), lmname, lmname_len);
|
||||||
if (fcc->function_handler != NULL) {
|
if (fcc->function_handler != NULL) {
|
||||||
STR_FREE(lmname);
|
free_alloca(lmname, use_heap);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
STR_FREE(lmname);
|
free_alloca(lmname, use_heap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Split name into class/namespace and method/function names */
|
/* Split name into class/namespace and method/function names */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue