]> granicus.if.org Git - php/commitdiff
Eliminate checks using ZEND_CONST_COND() macro
authorDmitry Stogov <dmitry@zend.com>
Thu, 12 Sep 2019 15:29:19 +0000 (18:29 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 12 Sep 2019 15:29:19 +0000 (18:29 +0300)
Zend/zend_execute.c

index 70c4bdc8e90427adbe7cebfcc08ce06d162c5fdb..bbfb53932161f0398e30f439f01aaee4a68bef2e 100644 (file)
@@ -2088,13 +2088,13 @@ num_undef:
                }
        } else if (EXPECTED(Z_TYPE_P(dim) == IS_STRING)) {
                offset_key = Z_STR_P(dim);
-               if (dim_type != IS_CONST) {
+               if (ZEND_CONST_COND(dim_type != IS_CONST, 1)) {
                        if (ZEND_HANDLE_NUMERIC(offset_key, hval)) {
                                goto num_index;
                        }
                }
 str_index:
-               retval = zend_hash_find_ex(ht, offset_key, dim_type == IS_CONST);
+               retval = zend_hash_find_ex(ht, offset_key, ZEND_CONST_COND(dim_type == IS_CONST, 0));
                if (retval) {
                        /* support for $GLOBALS[...] */
                        if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
@@ -2229,7 +2229,7 @@ fetch_from_array:
                }
                ZVAL_ERROR(result);
        } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
-               if (/*dim_type == IS_CV &&*/ dim && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+               if (ZEND_CONST_COND(dim_type == IS_CV, dim != NULL) && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
                        dim = ZVAL_UNDEFINED_OP2();
                }
                if (dim_type == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -2272,7 +2272,7 @@ fetch_from_array:
                        } else {
 return_null:
                                /* for read-mode only */
-                               if (/*dim_type == IS_CV &&*/ dim && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+                               if (ZEND_CONST_COND(dim_type == IS_CV, dim != NULL) && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
                                        ZVAL_UNDEFINED_OP2();
                                }
                                ZVAL_NULL(result);
@@ -2384,7 +2384,7 @@ try_string_offset:
                        ZVAL_INTERNED_STR(result, ZSTR_CHAR(c));
                }
        } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
-               if (/*dim_type == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+               if (ZEND_CONST_COND(dim_type == IS_CV, 1) && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
                        dim = ZVAL_UNDEFINED_OP2();
                }
                if (dim_type == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -2406,7 +2406,7 @@ try_string_offset:
                if (type != BP_VAR_IS && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
                        container = ZVAL_UNDEFINED_OP1();
                }
-               if (/*dim_type == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+               if (ZEND_CONST_COND(dim_type == IS_CV, 1) && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
                        ZVAL_UNDEFINED_OP2();
                }
                if (!is_list && type != BP_VAR_IS) {