com php-src: avoid repeated strlen() usage: ext/reflection/php _reflection.c
| From: | Anatol Belski | Date: | Sun, 14 Sep 2014 10:30:01 +0000 |
| Subject: | com php-src: avoid repeated strlen() usage: ext/reflection/php _reflection.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81583@lists.php.net to get a copy of this message | ||
Commit: 0b40abf41d67cacb605ea4def917428e078ca758
Author: Anatol Belski <ab@php.net> Sun, 14 Sep 2014 12:30:01 +0200
Parents: cbf530c7c065e8fd7009517a7ef3c81bc7e33a02
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0b40abf41d67cacb605ea4def917428e078ca758
Log:
avoid repeated strlen() usage
Changed paths:
M ext/reflection/php_reflection.c
Diff:
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index ad6a2fb..cd9f65d 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1298,15 +1298,18 @@ static void reflection_property_factory(zend_class_entry *ce,
zend_property_info
zval classname;
property_reference *reference;
const char *class_name, *prop_name;
+ int prop_name_len;
zend_unmangle_property_name(prop->name->val, prop->name->len, &class_name,
&prop_name);
+ prop_name_len = (int)strlen(prop_name);
+
if (!(prop->flags & ZEND_ACC_PRIVATE)) {
/* we have to search the class hierarchy for this (implicit) public or protected property */
zend_class_entry *tmp_ce = ce, *store_ce = ce;
zend_property_info *tmp_info = NULL;
- while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info,
prop_name, strlen(prop_name))) == NULL) {
+ while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info,
prop_name, prop_name_len)) == NULL) {
ce = tmp_ce;
tmp_ce = tmp_ce->parent;
}
@@ -1318,7 +1321,7 @@ static void reflection_property_factory(zend_class_entry *ce,
zend_property_info
}
}
- ZVAL_STRING(&name, prop_name);
+ ZVAL_STRINGL(&name, prop_name, prop_name_len);
ZVAL_STR(&classname, zend_string_copy(prop->ce->name));
reflection_instantiate(reflection_property_ptr, object TSRMLS_CC);