instanceof_class does not need to check for a NULL pointer in the
first iteration -- passing NULL to this function is illegal.
instanceof_interface does not need to use instanceof_class(), it
only has to check whether the CEs match exactly. There is no way
for an interface to appear inside "parent", it will always be in
"interfaces" only.
static zend_always_inline zend_bool instanceof_class(const zend_class_entry *instance_ce, const zend_class_entry *ce) /* {{{ */
{
- while (instance_ce) {
+ do {
if (instance_ce == ce) {
return 1;
}
instance_ce = instance_ce->parent;
- }
+ } while (instance_ce);
return 0;
}
/* }}} */
}
}
}
- return instanceof_class(instance_ce, ce);
+ return instance_ce == ce;
}
/* }}} */