mirror of
https://github.com/php/php-src.git
synced 2026-04-03 14:12:38 +02:00
Use zend_string_equals_literal() macro
This commit is contained in:
@@ -174,8 +174,7 @@ constant_binary_op:
|
||||
case ZEND_FETCH_CONSTANT:
|
||||
if (opline->op2_type == IS_CONST &&
|
||||
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING &&
|
||||
Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 &&
|
||||
memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) {
|
||||
zend_string_equals_literal(Z_STR(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__")) {
|
||||
/* substitute __COMPILER_HALT_OFFSET__ constant */
|
||||
zend_execute_data *orig_execute_data = EG(current_execute_data);
|
||||
zend_execute_data fake_execute_data;
|
||||
@@ -376,12 +375,8 @@ constant_binary_op:
|
||||
*/
|
||||
if (!send2_opline &&
|
||||
Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING) {
|
||||
if ((Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("function_exists")-1 &&
|
||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||
"function_exists", sizeof("function_exists")-1)) ||
|
||||
(Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable")-1 &&
|
||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||
"is_callable", sizeof("is_callable")))) {
|
||||
if (zend_string_equals_literal(Z_STR(ZEND_OP2_LITERAL(init_opline)), "function_exists") ||
|
||||
zend_string_equals_literal(Z_STR(ZEND_OP2_LITERAL(init_opline)), "is_callable")) {
|
||||
zend_internal_function *func;
|
||||
zend_string *lc_name = zend_string_tolower(
|
||||
Z_STR(ZEND_OP1_LITERAL(send1_opline)));
|
||||
@@ -410,9 +405,7 @@ constant_binary_op:
|
||||
}
|
||||
zend_string_release_ex(lc_name, 0);
|
||||
break;
|
||||
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("extension_loaded")-1 &&
|
||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||
"extension_loaded", sizeof("extension_loaded")-1)) {
|
||||
} else if (zend_string_equals_literal(Z_STR(ZEND_OP2_LITERAL(init_opline)), "extension_loaded")) {
|
||||
zval t;
|
||||
zend_string *lc_name = zend_string_tolower(
|
||||
Z_STR(ZEND_OP1_LITERAL(send1_opline)));
|
||||
@@ -451,9 +444,7 @@ constant_binary_op:
|
||||
zend_optimizer_update_op1_const(op_array, opline, &t);
|
||||
}
|
||||
break;
|
||||
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("constant")-1 &&
|
||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||
"constant", sizeof("constant")-1)) {
|
||||
} else if (zend_string_equals_literal(Z_STR(ZEND_OP2_LITERAL(init_opline)), "constant")) {
|
||||
zval t;
|
||||
|
||||
if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 1)) {
|
||||
@@ -472,9 +463,7 @@ constant_binary_op:
|
||||
}
|
||||
break;
|
||||
/* dirname(IS_CONST/IS_STRING) -> IS_CONST/IS_STRING */
|
||||
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("dirname")-1 &&
|
||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||
"dirname", sizeof("dirname") - 1) &&
|
||||
} else if (zend_string_equals_literal(Z_STR(ZEND_OP2_LITERAL(init_opline)), "dirname") &&
|
||||
IS_ABSOLUTE_PATH(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
|
||||
zend_string *dirname = zend_string_init(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)), 0);
|
||||
ZSTR_LEN(dirname) = zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname));
|
||||
|
||||
Reference in New Issue
Block a user