From b02b81299ccef7de244bac7ffc605e3d2943fa88 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 7 Oct 2019 17:57:49 +0300 Subject: Comparison cleanup: - introduce zend_compare() that returns -1,0,1 dirctly (without intermediate zval) - remove compare_objects() object handler, and keep only compare() handler --- Zend/zend_operators.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'Zend/zend_operators.h') diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index e225e5eace..860d71b1d5 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -396,6 +396,8 @@ again: return result; } +ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2); + ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2); ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2); @@ -850,7 +852,6 @@ static zend_always_inline int zend_fast_equal_strings(zend_string *s1, zend_stri static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2) { - zval result; if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { return Z_LVAL_P(op1) == Z_LVAL_P(op2); @@ -868,28 +869,23 @@ static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2) return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); } } - compare_function(&result, op1, op2); - return Z_LVAL(result) == 0; + return zend_compare(op1, op2) == 0; } static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2) { - zval result; if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { return Z_LVAL_P(op1) == Z_LVAL_P(op2); } - compare_function(&result, op1, op2); - return Z_LVAL(result) == 0; + return zend_compare(op1, op2) == 0; } static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2) { - zval result; if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2)); } - compare_function(&result, op1, op2); - return Z_LVAL(result) == 0; + return zend_compare(op1, op2) == 0; } static zend_always_inline zend_bool fast_is_identical_function(zval *op1, zval *op2) -- cgit v1.2.1