Skip to content

Commit

Permalink
Drop unnecessary checks in get_closure
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Apr 16, 2016
1 parent e015faa commit 3dd2df8
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/* }}} */
Expand Down

0 comments on commit 3dd2df8

Please sign in to comment.