summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 932646265c..8a1bf5a74f 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -354,7 +354,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (PZVAL_IS_LOCKED(value)) {
zval *orig_value = value;
- value = ALLOC_ZVAL();
+ ALLOC_ZVAL(value);
*value = *orig_value;
value->refcount=0;
zval_copy_ctor(value);
@@ -392,7 +392,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (PZVAL_IS_LOCKED(value)) {
zval *orig_value = value;
- value = ALLOC_ZVAL();
+ ALLOC_ZVAL(value);
*value = *orig_value;
value->refcount=0;
zval_copy_ctor(value);
@@ -401,7 +401,8 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
/* break missing intentionally */
case IS_CONST:
if (PZVAL_IS_REF(value) && value->refcount > 0) {
- variable_ptr = *variable_ptr_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(variable_ptr);
+ *variable_ptr_ptr = variable_ptr;
*variable_ptr = *value;
zval_copy_ctor(variable_ptr);
variable_ptr->refcount=1;
@@ -411,7 +412,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
value->refcount++;
break;
case IS_TMP_VAR:
- (*variable_ptr_ptr) = ALLOC_ZVAL();
+ ALLOC_ZVAL(*variable_ptr_ptr);
value->refcount=1;
**variable_ptr_ptr = *value;
break;
@@ -661,7 +662,8 @@ static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode
if (!PZVAL_IS_REF(container)) {
container->refcount--;
if (container->refcount>0) {
- container = *container_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(container);
+ *container_ptr = container;
container->is_ref=0;
}
container->refcount=1;
@@ -675,7 +677,7 @@ static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode
case IS_ARRAY:
if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
container->refcount--;
- *container_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(*container_ptr);
**container_ptr = *container;
container = *container_ptr;
INIT_PZVAL(container);
@@ -836,7 +838,8 @@ static inline void zend_fetch_property_address(znode *result, znode *op1, znode
if (!PZVAL_IS_REF(container)) {
container->refcount--;
if (container->refcount>0) {
- container = *container_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(container);
+ *container_ptr = container;
container->is_ref=0;
}
container->refcount=1;
@@ -863,7 +866,7 @@ static inline void zend_fetch_property_address(znode *result, znode *op1, znode
if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
container->refcount--;
- *container_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(*container_ptr);
**container_ptr = *container;
container = *container_ptr;
INIT_PZVAL(container);
@@ -959,8 +962,9 @@ void execute(zend_op_array *op_array ELS_DC)
#endif
if (op_array->uses_globals) {
- zval *globals = ALLOC_ZVAL();
+ zval *globals;
+ ALLOC_ZVAL(globals);
globals->refcount=1;
globals->is_ref=1;
globals->type = IS_ARRAY;
@@ -1089,7 +1093,7 @@ binary_assign_op_addr: {
zval *orig_var=*var_ptr;
(*var_ptr)->refcount--;
- *var_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(*var_ptr);
**var_ptr = *orig_var;
zendi_zval_copy_ctor(**var_ptr);
(*var_ptr)->refcount=1;
@@ -1134,7 +1138,7 @@ binary_assign_op_addr: {
zval *orig_var = *var_ptr;
(*var_ptr)->refcount--;
- *var_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(*var_ptr);
**var_ptr = *orig_var;
zendi_zval_copy_ctor(**var_ptr);
(*var_ptr)->refcount=1;
@@ -1502,7 +1506,7 @@ do_fcall_common:
Ts[opline->result.u.var].var.ptr_ptr = &Ts[opline->result.u.var].var.ptr;
if (function_state.function->type==ZEND_INTERNAL_FUNCTION) {
- Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr));
((zend_internal_function *) function_state.function)->handler(opline->extended_value, Ts[opline->result.u.var].var.ptr, &EG(regular_list), &EG(persistent_list), object.ptr, return_value_used);
if (object.ptr) {
@@ -1546,7 +1550,7 @@ do_fcall_common:
zend_execute(EG(active_op_array) ELS_CC);
if (return_value_used && !Ts[opline->result.u.var].var.ptr) {
- Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*Ts[opline->result.u.var].var.ptr);
} else if (!return_value_used && Ts[opline->result.u.var].var.ptr) {
zval_ptr_dtor(&Ts[opline->result.u.var].var.ptr);
@@ -1563,7 +1567,7 @@ do_fcall_common:
}
EG(active_symbol_table) = calling_symbol_table;
} else { /* ZEND_OVERLOADED_FUNCTION */
- Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr));
call_overloaded_function(opline->extended_value, Ts[opline->result.u.var].var.ptr, &EG(regular_list), &EG(persistent_list) ELS_CC);
efree(fbc);
@@ -1602,7 +1606,7 @@ do_fcall_common:
if (!EG(free_op1)) { /* Not a temp var */
if (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0) {
- *(EG(return_value_ptr_ptr)) = ALLOC_ZVAL();
+ ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
**EG(return_value_ptr_ptr) = *retval_ptr;
(*EG(return_value_ptr_ptr))->is_ref = 0;
(*EG(return_value_ptr_ptr))->refcount = 1;
@@ -1612,7 +1616,7 @@ do_fcall_common:
retval_ptr->refcount++;
}
} else {
- *(EG(return_value_ptr_ptr))= ALLOC_ZVAL();
+ ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
**EG(return_value_ptr_ptr) = *retval_ptr;
(*EG(return_value_ptr_ptr))->refcount = 1;
(*EG(return_value_ptr_ptr))->is_ref = 0;
@@ -1632,8 +1636,9 @@ do_fcall_common:
zend_error(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num);
}
{
- zval *valptr = ALLOC_ZVAL();
+ zval *valptr;
+ ALLOC_ZVAL(valptr);
*valptr = Ts[opline->op1.u.var].tmp_var;
INIT_PZVAL(valptr);
zend_ptr_stack_push(&EG(argument_stack), valptr);
@@ -1651,13 +1656,13 @@ do_fcall_common:
RESUME_GARBAGE();
if (varptr == &EG(uninitialized_zval)) {
- varptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(varptr);
INIT_ZVAL(*varptr);
varptr->refcount = 0;
} else if (PZVAL_IS_REF(varptr)) {
zval *original_var = varptr;
- varptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(varptr);
*varptr = *original_var;
varptr->is_ref = 0;
varptr->refcount = 0;
@@ -1682,7 +1687,7 @@ send_by_ref:
/* code to break away this variable */
if (varptr->refcount>1) {
varptr->refcount--;
- *varptr_ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(*varptr_ptr);
**varptr_ptr = *varptr;
varptr = *varptr_ptr;
varptr->refcount = 1;
@@ -1721,9 +1726,10 @@ send_by_ref:
break;
}
if (opline->op2.u.constant.type == IS_CONSTANT) {
- zval *default_value = ALLOC_ZVAL();
+ zval *default_value;
zval tmp;
+ ALLOC_ZVAL(default_value);
*default_value = opline->op2.u.constant;
if (!zend_get_constant(default_value->value.str.val, default_value->value.str.len, &tmp)) {
default_value->type = IS_STRING;
@@ -1886,8 +1892,9 @@ send_by_ref:
}
}
if (opline->op1.op_type == IS_TMP_VAR) { /* temporary variable */
- zval *new_expr = ALLOC_ZVAL();
+ zval *new_expr;
+ ALLOC_ZVAL(new_expr);
*new_expr = *expr_ptr;
expr_ptr = new_expr;
INIT_PZVAL(expr_ptr);
@@ -1900,8 +1907,9 @@ send_by_ref:
}
expr_ptr->refcount++;
} else if (PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr = ALLOC_ZVAL();
+ zval *new_expr;
+ ALLOC_ZVAL(new_expr);
*new_expr = *expr_ptr;
expr_ptr = new_expr;
zendi_zval_copy_ctor(*expr_ptr);
@@ -1994,7 +2002,7 @@ send_by_ref:
}
} else { /* return value is used */
if (!Ts[opline->result.u.var].var.ptr) { /* there was no return statement */
- Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_PZVAL(Ts[opline->result.u.var].var.ptr);
Ts[opline->result.u.var].var.ptr->value.lval = 1;
Ts[opline->result.u.var].var.ptr->type = IS_LONG;
@@ -2008,7 +2016,7 @@ send_by_ref:
efree(new_op_array);
} else {
if (return_value_used) {
- Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
+ ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*Ts[opline->result.u.var].var.ptr);
}
}
@@ -2104,7 +2112,7 @@ send_by_ref:
(*value)->refcount++;
zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL);
- key = ALLOC_ZVAL();
+ ALLOC_ZVAL(key);
INIT_PZVAL(key);
switch (zend_hash_get_current_key(array->value.ht, &str_key, &int_key)) {
case HASH_KEY_IS_STRING: