diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-11-14 11:33:14 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-11-14 11:33:14 +0300 |
commit | 8bda22592e4a3b1c1735c6ca25d7f0404d511e53 (patch) | |
tree | e3c01f8d67aba200942c2944bd1b290e80d43f1c /ext/intl/calendar | |
parent | 5ebefa74cfcb52b068caf8493f6187c9825aec2f (diff) | |
download | php-git-8bda22592e4a3b1c1735c6ca25d7f0404d511e53.tar.gz |
Eliminate useless $this related check
Diffstat (limited to 'ext/intl/calendar')
-rw-r--r-- | ext/intl/calendar/calendar_methods.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index d85b06251b..dfe34a4f03 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -409,23 +409,25 @@ U_CFUNC PHP_FUNCTION(intlcal_set) int variant; /* number of args of the set() overload */ CALENDAR_METHOD_INIT_VARS; + object = getThis(); + /* must come before zpp because zpp would convert the args in the stack to 0 */ - if (ZEND_NUM_ARGS() > (getThis() ? 6 : 7) || + if (ZEND_NUM_ARGS() > (object ? 6 : 7) || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: too many arguments", 0); RETURN_FALSE; } - if (!getThis()) { + if (!object) { args++; } - variant = ZEND_NUM_ARGS() - (getThis() ? 0 : 1); + variant = ZEND_NUM_ARGS() - (object ? 0 : 1); while (variant > 2 && Z_TYPE(args[variant - 1]) == IS_NULL) { variant--; } if (variant == 4 || - zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), + zend_parse_method_parameters(ZEND_NUM_ARGS(), object, "Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -472,17 +474,19 @@ U_CFUNC PHP_FUNCTION(intlcal_roll) zend_bool bool_variant_val = (zend_bool)-1; CALENDAR_METHOD_INIT_VARS; - if (ZEND_NUM_ARGS() > (getThis() ? 2 :3) || + object = getThis(); + + if (ZEND_NUM_ARGS() > (object ? 2 :3) || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: too many arguments", 0); RETURN_FALSE; } - if (!getThis()) { + if (!object) { args++; } if (!Z_ISUNDEF(args[1]) && (Z_TYPE(args[1]) == IS_TRUE || Z_TYPE(args[1]) == IS_FALSE)) { - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), + if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object, "Olb", &object, Calendar_ce_ptr, &field, &bool_variant_val) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -490,7 +494,7 @@ U_CFUNC PHP_FUNCTION(intlcal_roll) RETURN_FALSE; } bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0; - } else if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), + } else if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object, "Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_roll: bad arguments", 0); |