optimize out strlen() calls

# Patch by Matt Wilmas
This commit is contained in:
Ilia Alshanetsky 2006-12-13 15:31:47 +00:00
parent 1c4806c515
commit a055e93a27
2 changed files with 6 additions and 5 deletions

View File

@ -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);
}
}
}

View File

@ -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);