mirror of
https://github.com/php/php-src.git
synced 2024-12-01 13:54:10 +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 {
|
} else {
|
||||||
/* other strings */
|
/* 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) {
|
if(Z_TYPE_PP(args) != IS_ARRAY) {
|
||||||
convert_to_array_ex(args);
|
convert_to_array_ex(args);
|
||||||
}
|
}
|
||||||
zend_hash_next_index_insert(HASH_OF(*args), (void *)&val, sizeof(zval *), NULL);
|
zend_hash_next_index_insert(HASH_OF(*args), (void *)&val, sizeof(zval *), NULL);
|
||||||
} else {
|
} 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);
|
add_property_zval(ent2->data, ent1->varname, ent1->data);
|
||||||
EG(scope) = old_scope;
|
EG(scope) = old_scope;
|
||||||
} else {
|
} else {
|
||||||
long l;
|
long l;
|
||||||
double d;
|
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:
|
case IS_DOUBLE:
|
||||||
if (d > INT_MAX) {
|
if (d > INT_MAX) {
|
||||||
goto bigint;
|
goto bigint;
|
||||||
@ -988,7 +989,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bigint:
|
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);
|
efree(ent1->varname);
|
||||||
|
Loading…
Reference in New Issue
Block a user