Skip to content

Commit 1b998bb

Browse files
committed
Remove unnecessary convert_to_string_safe macro
I'm assuming that the reason this existed was to avoid modifying an interned string. However, the current code handles this case fine already.
1 parent 89a7b7c commit 1b998bb

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

ext/opcache/Optimizer/block_pass.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int
8181
#define VAR_SOURCE(op) Tsource[VAR_NUM(op.var)]
8282
#define SET_VAR_SOURCE(opline) Tsource[VAR_NUM(opline->result.var)] = opline
8383

84-
#define convert_to_string_safe(v) \
85-
if (Z_TYPE_P((v)) == IS_NULL) { \
86-
ZVAL_STRINGL((v), "", 0); \
87-
} else { \
88-
convert_to_string((v)); \
89-
}
90-
9184
static void strip_leading_nops(zend_op_array *op_array, zend_basic_block *b)
9285
{
9386
zend_op *opcodes = op_array->opcodes;
@@ -311,10 +304,10 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
311304
int l, old_len;
312305

313306
if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
314-
convert_to_string_safe(&ZEND_OP1_LITERAL(opline));
307+
convert_to_string(&ZEND_OP1_LITERAL(opline));
315308
}
316309
if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
317-
convert_to_string_safe(&ZEND_OP1_LITERAL(last_op));
310+
convert_to_string(&ZEND_OP1_LITERAL(last_op));
318311
}
319312
old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op));
320313
l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
@@ -694,10 +687,10 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
694687
int l, old_len;
695688

696689
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
697-
convert_to_string_safe(&ZEND_OP2_LITERAL(opline));
690+
convert_to_string(&ZEND_OP2_LITERAL(opline));
698691
}
699692
if (Z_TYPE(ZEND_OP2_LITERAL(src)) != IS_STRING) {
700-
convert_to_string_safe(&ZEND_OP2_LITERAL(src));
693+
convert_to_string(&ZEND_OP2_LITERAL(src));
701694
}
702695

703696
VAR_SOURCE(opline->op1) = NULL;

0 commit comments

Comments
 (0)