mirror of
https://github.com/php/php-src.git
synced 2024-12-01 05:43:38 +08:00
optimize out strlen() calls
# Patch by Matt Wilmas
This commit is contained in:
parent
1c4806c515
commit
a055e93a27
@ -4665,13 +4665,13 @@ PHP_FUNCTION(getopt)
|
||||
}
|
||||
} else {
|
||||
/* other strings */
|
||||
if(zend_hash_find(HASH_OF(return_value), optname, strlen(optname)+1, (void **)&args) != FAILURE) {
|
||||
if(zend_hash_find(HASH_OF(return_value), optname, optname_len + 1, (void **)&args) != FAILURE) {
|
||||
if(Z_TYPE_PP(args) != IS_ARRAY) {
|
||||
convert_to_array_ex(args);
|
||||
}
|
||||
zend_hash_next_index_insert(HASH_OF(*args), (void *)&val, sizeof(zval *), NULL);
|
||||
} else {
|
||||
zend_hash_add(HASH_OF(return_value), optname, strlen(optname)+1, (void *)&val, sizeof(zval *), NULL);
|
||||
zend_hash_add(HASH_OF(return_value), optname, optname_len + 1, (void *)&val, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -974,10 +974,11 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
|
||||
add_property_zval(ent2->data, ent1->varname, ent1->data);
|
||||
EG(scope) = old_scope;
|
||||
} else {
|
||||
long l;
|
||||
long l;
|
||||
double d;
|
||||
int varname_len = strlen(ent1->varname);
|
||||
|
||||
switch (is_numeric_string(ent1->varname, strlen(ent1->varname), &l, &d, 0)) {
|
||||
switch (is_numeric_string(ent1->varname, varname_len, &l, &d, 0)) {
|
||||
case IS_DOUBLE:
|
||||
if (d > INT_MAX) {
|
||||
goto bigint;
|
||||
@ -988,7 +989,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
|
||||
break;
|
||||
default:
|
||||
bigint:
|
||||
zend_hash_update(target_hash,ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL);
|
||||
zend_hash_update(target_hash,ent1->varname, varname_len + 1, &ent1->data, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
efree(ent1->varname);
|
||||
|
Loading…
Reference in New Issue
Block a user