mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +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)
|
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) {
|
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;
|
int i, ce_num, if_num = iface->num_interfaces;
|
||||||
zend_class_entry *entry;
|
zend_class_entry *entry;
|
||||||
|
|
||||||
if (if_num) {
|
if (if_num==0) {
|
||||||
ce_num = ce->num_interfaces;
|
return;
|
||||||
if (ce->type == ZEND_INTERNAL_CLASS) {
|
}
|
||||||
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
ce_num = ce->num_interfaces;
|
||||||
} else {
|
|
||||||
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* only have every interface ones - this holds for the list we append too, what makes the test a bit faster */
|
if (ce->type == ZEND_INTERNAL_CLASS) {
|
||||||
while (if_num--) {
|
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
||||||
entry = iface->interfaces[if_num];
|
} else {
|
||||||
for (i = 0; i < ce_num; ++i) {
|
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
|
||||||
if (ce->interfaces[i] == entry) {
|
}
|
||||||
break;
|
|
||||||
}
|
/* Inherit the interfaces, only if they're not already inherited by the class */
|
||||||
}
|
while (if_num--) {
|
||||||
if (i == ce_num) {
|
entry = iface->interfaces[if_num];
|
||||||
ce->interfaces[ce->num_interfaces++] = entry;
|
for (i = 0; i < ce_num; i++) {
|
||||||
|
if (ce->interfaces[i] == entry) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i == ce_num) {
|
||||||
/* and now call the implementing handlers */
|
ce->interfaces[ce->num_interfaces++] = entry;
|
||||||
while (ce_num < ce->num_interfaces) {
|
|
||||||
do_implement_interface(ce, ce->interfaces[ce_num++] TSRMLS_CC);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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