mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Code relayout
This commit is contained in:
parent
c15d4ddb2b
commit
673e6e23e7
1 changed files with 24 additions and 21 deletions
|
@ -1847,6 +1847,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
|||
}
|
||||
|
||||
|
||||
|
||||
static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC)
|
||||
{
|
||||
if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce TSRMLS_CC) == FAILURE) {
|
||||
|
@ -1861,32 +1862,34 @@ ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry
|
|||
int i, ce_num, if_num = iface->num_interfaces;
|
||||
zend_class_entry *entry;
|
||||
|
||||
if (if_num) {
|
||||
ce_num = ce->num_interfaces;
|
||||
if (ce->type == ZEND_INTERNAL_CLASS) {
|
||||
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
||||
} else {
|
||||
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
||||
}
|
||||
if (if_num==0) {
|
||||
return;
|
||||
}
|
||||
ce_num = ce->num_interfaces;
|
||||
|
||||
/* only have every interface ones - this holds for the list we append too, what makes the test a bit faster */
|
||||
while (if_num--) {
|
||||
entry = iface->interfaces[if_num];
|
||||
for (i = 0; i < ce_num; ++i) {
|
||||
if (ce->interfaces[i] == entry) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == ce_num) {
|
||||
ce->interfaces[ce->num_interfaces++] = entry;
|
||||
if (ce->type == ZEND_INTERNAL_CLASS) {
|
||||
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
||||
} else {
|
||||
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
||||
}
|
||||
|
||||
/* Inherit the interfaces, only if they're not already inherited by the class */
|
||||
while (if_num--) {
|
||||
entry = iface->interfaces[if_num];
|
||||
for (i = 0; i < ce_num; i++) {
|
||||
if (ce->interfaces[i] == entry) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* and now call the implementing handlers */
|
||||
while (ce_num < ce->num_interfaces) {
|
||||
do_implement_interface(ce, ce->interfaces[ce_num++] TSRMLS_CC);
|
||||
if (i == ce_num) {
|
||||
ce->interfaces[ce->num_interfaces++] = entry;
|
||||
}
|
||||
}
|
||||
|
||||
/* and now call the implementing handlers */
|
||||
while (ce_num < ce->num_interfaces) {
|
||||
do_implement_interface(ce, ce->interfaces[ce_num++] TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue