summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-06-03 13:43:05 +0300
committerDmitry Stogov <dmitry@zend.com>2015-06-03 13:43:05 +0300
commit6bcf121f5b990cbaee6324fb729b52e17a7bd7f2 (patch)
treeb5f0cbb95ed7768845b92d250fd6ff4e71d8c344
parentc09698753e7d1d95299dca54c8ca888c885fd45b (diff)
downloadphp-git-6bcf121f5b990cbaee6324fb729b52e17a7bd7f2.tar.gz
micro-optimization
-rw-r--r--Zend/zend_API.c19
-rw-r--r--Zend/zend_inheritance.c2
-rw-r--r--Zend/zend_object_handlers.c15
3 files changed, 15 insertions, 21 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 757becf746..3a83f5f7f3 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -3665,18 +3665,13 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
break;
}
}
- switch (access_type & ZEND_ACC_PPP_MASK) {
- case ZEND_ACC_PRIVATE: {
- property_info->name = zend_mangle_property_name(ce->name->val, ce->name->len, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
- }
- break;
- case ZEND_ACC_PROTECTED: {
- property_info->name = zend_mangle_property_name("*", 1, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
- }
- break;
- case ZEND_ACC_PUBLIC:
- property_info->name = zend_string_copy(name);
- break;
+ if (access_type & ZEND_ACC_PUBLIC) {
+ property_info->name = zend_string_copy(name);
+ } else if (access_type & ZEND_ACC_PRIVATE) {
+ property_info->name = zend_mangle_property_name(ce->name->val, ce->name->len, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
+ } else {
+ ZEND_ASSERT(access_type & ZEND_ACC_PROTECTED);
+ property_info->name = zend_mangle_property_name("*", 1, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
}
property_info->name = zend_new_interned_string(property_info->name);
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index f32c55aaef..608af74353 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1451,7 +1451,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
* then check whether the property is already there
*/
flags = property_info->flags;
- if ((flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
+ if (flags & ZEND_ACC_PUBLIC) {
prop_name = zend_string_copy(property_info->name);
} else {
const char *pname;
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 0127a9cf04..259679a57f 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -265,15 +265,14 @@ static void zend_std_call_issetter(zval *object, zval *member, zval *retval) /*
static zend_always_inline int zend_verify_property_access(zend_property_info *property_info, zend_class_entry *ce) /* {{{ */
{
- switch (property_info->flags & ZEND_ACC_PPP_MASK) {
- case ZEND_ACC_PUBLIC:
- return 1;
- case ZEND_ACC_PROTECTED:
- return zend_check_protected(property_info->ce, EG(scope));
- case ZEND_ACC_PRIVATE:
- return (ce == EG(scope) || property_info->ce == EG(scope));
+ if (property_info->flags & ZEND_ACC_PUBLIC) {
+ return 1;
+ } else if (property_info->flags & ZEND_ACC_PRIVATE) {
+ return (ce == EG(scope) || property_info->ce == EG(scope));
+ } else {
+ ZEND_ASSERT(property_info->flags & ZEND_ACC_PROTECTED);
+ return zend_check_protected(property_info->ce, EG(scope));
}
- return 0;
}
/* }}} */