Skip to content

Commit 4cc8625

Browse files
committed
Get rid of ZVAL_RESET...
1 parent dc60b4d commit 4cc8625

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

Zend/zend_operators.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "zend_globals.h"
3131
#include "zend_list.h"
3232
#include "zend_fast_cache.h"
33+
#include "zend_API.h"
3334

3435
#if 0&&WITH_BCMATH
3536
#include "ext/bcmath/number.h"
@@ -462,7 +463,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC)
462463
break;
463464
default:
464465
zval_dtor(op);
465-
ZVAL_RESET(op);
466+
ZVAL_BOOL(op, 0);
466467
break;
467468
}
468469
op->type = IS_STRING;
@@ -719,7 +720,7 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2)
719720

720721
if ((op2->type == IS_LONG && op2->value.lval == 0) || (op2->type == IS_DOUBLE && op2->value.dval == 0.0)) {
721722
zend_error(E_WARNING, "Division by zero");
722-
ZVAL_RESET(result);
723+
ZVAL_BOOL(result, 0);
723724
return FAILURE; /* division by zero */
724725
}
725726
if (op1->type == IS_LONG && op2->type == IS_LONG) {
@@ -758,7 +759,7 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2)
758759
zendi_convert_to_long(op2, op2_copy, result);
759760

760761
if (op2->value.lval == 0) {
761-
ZVAL_RESET(result);
762+
ZVAL_BOOL(result, 0);
762763
return FAILURE; /* modulus by zero */
763764
}
764765

@@ -1164,7 +1165,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2)
11641165
return SUCCESS;
11651166
}
11661167

1167-
ZVAL_RESET(result);
1168+
ZVAL_BOOL(result, 0);
11681169
return FAILURE;
11691170
}
11701171

@@ -1231,7 +1232,7 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2)
12311232
}
12321233
break;
12331234
default:
1234-
ZVAL_RESET(result);
1235+
ZVAL_BOOL(result, 0);
12351236
return FAILURE;
12361237
}
12371238
return SUCCESS;

Zend/zend_variables.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ ZEND_API void zval_add_ref(zval **p);
5454
#define ZVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor_wrapper
5555
#define ZVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper
5656

57-
#define ZVAL_RESET(var) \
58-
(var)->type = IS_BOOL; \
59-
(var)->value.lval = 0;
60-
6157
ZEND_API void var_uninit(zval *var);
6258

6359
#endif

0 commit comments

Comments
 (0)