mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
Use cheaper API
This commit is contained in:
parent
744d3c5753
commit
4dfbfe93aa
@ -807,6 +807,19 @@ static zend_always_inline void *zend_hash_find_ptr(const HashTable *ht, zend_str
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void *zend_hash_find_ex_ptr(const HashTable *ht, zend_string *key, zend_bool known_hash)
|
||||
{
|
||||
zval *zv;
|
||||
|
||||
zv = zend_hash_find_ex(ht, key, known_hash);
|
||||
if (zv) {
|
||||
ZEND_ASSUME(Z_PTR_P(zv));
|
||||
return Z_PTR_P(zv);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void *zend_hash_str_find_ptr(const HashTable *ht, const char *str, size_t len)
|
||||
{
|
||||
zval *zv;
|
||||
|
@ -1729,7 +1729,7 @@ int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **f
|
||||
|
||||
ce = Z_OBJCE_P(obj);
|
||||
|
||||
if ((func = zend_hash_find(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE))) == NULL) {
|
||||
if ((func = zend_hash_find_ex(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE), 1)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
*fptr_ptr = Z_FUNC_P(func);
|
||||
|
@ -165,7 +165,7 @@ static zend_object_handlers reflection_object_handlers;
|
||||
|
||||
static zval *_default_load_name(zval *object) /* {{{ */
|
||||
{
|
||||
return zend_hash_find_ind(Z_OBJPROP_P(object), ZSTR_KNOWN(ZEND_STR_NAME));
|
||||
return zend_hash_find_ex_ind(Z_OBJPROP_P(object), ZSTR_KNOWN(ZEND_STR_NAME), 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -817,8 +817,8 @@ static zend_bool php_auto_globals_create_server(zend_string *name)
|
||||
if (SG(request_info).argc) {
|
||||
zval *argc, *argv;
|
||||
|
||||
if ((argc = zend_hash_find_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGC))) != NULL &&
|
||||
(argv = zend_hash_find_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGV))) != NULL) {
|
||||
if ((argc = zend_hash_find_ex_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGC), 1)) != NULL &&
|
||||
(argv = zend_hash_find_ex_ind(&EG(symbol_table), ZSTR_KNOWN(ZEND_STR_ARGV), 1)) != NULL) {
|
||||
Z_ADDREF_P(argv);
|
||||
zend_hash_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZSTR_KNOWN(ZEND_STR_ARGV), argv);
|
||||
zend_hash_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZSTR_KNOWN(ZEND_STR_ARGC), argc);
|
||||
|
@ -1814,7 +1814,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
|
||||
}
|
||||
|
||||
/* Check again, the original check might have not known the protocol name */
|
||||
if ((wrapper = zend_hash_find_ptr(wrapper_hash, ZSTR_KNOWN(ZEND_STR_FILE))) != NULL) {
|
||||
if ((wrapper = zend_hash_find_ex_ptr(wrapper_hash, ZSTR_KNOWN(ZEND_STR_FILE), 1)) != NULL) {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user