From: Nikita Popov Date: Sat, 16 Apr 2016 13:15:44 +0000 (+0200) Subject: Drop unnecessary checks in get_closure X-Git-Tag: php-7.1.0alpha1~312 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3dd2df85b33ea1b5e13bcdb8e73c982cfacd5be4;p=php Drop unnecessary checks in get_closure --- diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index a00d000e6e..989ef769c8 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -382,23 +382,16 @@ static zend_object *zend_closure_clone(zval *zobject) /* {{{ */ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */ { - zend_closure *closure; - - if (Z_TYPE_P(obj) != IS_OBJECT) { - return FAILURE; - } - - closure = (zend_closure *)Z_OBJ_P(obj); + zend_closure *closure = (zend_closure *)Z_OBJ_P(obj); *fptr_ptr = &closure->func; *ce_ptr = closure->called_scope; - if (obj_ptr) { - if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { - *obj_ptr = Z_OBJ(closure->this_ptr); - } else { - *obj_ptr = NULL; - } + if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { + *obj_ptr = Z_OBJ(closure->this_ptr); + } else { + *obj_ptr = NULL; } + return SUCCESS; } /* }}} */