From 0adbf6de774d9b1938a34b969c40ea2ac1982222 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 9 Dec 2015 11:37:40 +0800 Subject: [PATCH] Remove useless check --- ext/reflection/php_reflection.c | 37 +++------------------------------ 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 80001e4997..b81ce75525 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -104,7 +104,7 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) #define GET_REFLECTION_OBJECT() \ intern = Z_REFLECTION_P(getThis()); \ - if (intern == NULL || intern->ptr == NULL) { \ + if (intern->ptr == NULL) { \ RETURN_ON_EXCEPTION \ php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the reflection object"); \ } \ @@ -1459,7 +1459,7 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO parameter_reference *param; intern = Z_REFLECTION_P(getThis()); - if (intern == NULL || intern->ptr == NULL) { + if (intern->ptr == NULL) { if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { return NULL; } @@ -1613,9 +1613,6 @@ ZEND_METHOD(reflection_function, __construct) object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "O", &closure, zend_ce_closure) == SUCCESS) { fptr = (zend_function*)zend_get_closure_method_def(closure); @@ -2157,9 +2154,6 @@ ZEND_METHOD(reflection_generator, __construct) object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O", &generator, zend_ce_generator) == FAILURE) { return; @@ -2346,9 +2340,6 @@ ZEND_METHOD(reflection_parameter, __construct) object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } /* First, find the function */ switch (Z_TYPE_P(reference)) { @@ -3051,9 +3042,6 @@ ZEND_METHOD(reflection_method, __construct) object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } /* Find the class entry */ switch (Z_TYPE_P(classname)) { @@ -3660,10 +3648,6 @@ ZEND_METHOD(reflection_method, setAccessible) intern = Z_REFLECTION_P(getThis()); - if (intern == NULL) { - return; - } - intern->ignore_visibility = visible; } /* }}} */ @@ -3697,9 +3681,6 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } if (Z_TYPE_P(argument) == IS_OBJECT) { ZVAL_STR_COPY(&classname, Z_OBJCE_P(argument)->name); @@ -5191,9 +5172,6 @@ ZEND_METHOD(reflection_property, __construct) object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } /* Find the class entry */ switch (Z_TYPE_P(classname)) { @@ -5542,10 +5520,6 @@ ZEND_METHOD(reflection_property, setAccessible) intern = Z_REFLECTION_P(getThis()); - if (intern == NULL) { - return; - } - intern->ignore_visibility = visible; } /* }}} */ @@ -5577,9 +5551,7 @@ ZEND_METHOD(reflection_extension, __construct) object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } + lcname = do_alloca(name_len + 1, use_heap); zend_str_tolower_copy(lcname, name_str, name_len); if ((module = zend_hash_str_find_ptr(&module_registry, lcname, name_len)) == NULL) { @@ -5945,9 +5917,6 @@ ZEND_METHOD(reflection_zend_extension, __construct) object = getThis(); intern = Z_REFLECTION_P(object); - if (intern == NULL) { - return; - } extension = zend_get_extension(name_str); if (!extension) { -- 2.40.0