]> granicus.if.org Git - php/commitdiff
Drop unnecessary checks in get_closure
authorNikita Popov <nikic@php.net>
Sat, 16 Apr 2016 13:15:44 +0000 (15:15 +0200)
committerNikita Popov <nikic@php.net>
Sat, 16 Apr 2016 18:23:23 +0000 (20:23 +0200)
Zend/zend_closures.c

index a00d000e6eb5686e60cacad03893585de2c457b3..989ef769c8e30d9718bca031c8272787f3b7b378 100644 (file)
@@ -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;
 }
 /* }}} */