1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 14:12:38 +02:00

- Don't use magic numbers

This commit is contained in:
Andi Gutmans
2004-08-12 05:54:11 +00:00
parent de25255b6d
commit 993f70c1d2
3 changed files with 8 additions and 6 deletions

View File

@@ -3353,7 +3353,7 @@ void zend_do_foreach_cont(znode *value, znode *key, znode *as_token, znode *fore
value = tmp;
/* Mark extended_value in case both key and value are being used */
CG(active_op_array)->opcodes[foreach_token->u.opline_num].extended_value |= 2;
CG(active_op_array)->opcodes[foreach_token->u.opline_num].extended_value |= ZEND_FE_FETCH_WITH_KEY;
}
if ((key->op_type != IS_UNUSED) && (key->u.EA.type & ZEND_PARSED_REFERENCE_VARIABLE)) {
@@ -3366,7 +3366,7 @@ void zend_do_foreach_cont(znode *value, znode *key, znode *as_token, znode *fore
zend_error(E_COMPILE_ERROR, "Cannot create references to elements of a temporary array expression");
}
/* Mark extended_value for assign-by-reference */
CG(active_op_array)->opcodes[foreach_token->u.opline_num].extended_value |= 1;
CG(active_op_array)->opcodes[foreach_token->u.opline_num].extended_value |= ZEND_FE_FETCH_BYREF;
}
if (key->op_type != IS_UNUSED) {

View File

@@ -794,6 +794,9 @@ int zendlex(znode *zendlval TSRMLS_DC);
#define ZEND_FETCH_STANDARD 0
#define ZEND_FETCH_ADD_LOCK 1
#define ZEND_FE_FETCH_BYREF 1
#define ZEND_FE_FETCH_WITH_KEY 2
#define ZEND_MEMBER_FUNC_CALL 1<<0
#define ZEND_ARG_SEND_BY_REF (1<<0)

View File

@@ -3779,8 +3779,7 @@ int zend_fe_fetch_handler(ZEND_OPCODE_HANDLER_ARGS)
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
int key_type;
/* extended_value & 2 means that the key is also needed */
zend_bool use_key = opline->extended_value & 2;
zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
PZVAL_LOCK(array);
@@ -3858,13 +3857,13 @@ int zend_fe_fetch_handler(ZEND_OPCODE_HANDLER_ARGS)
break;
}
if (opline->extended_value & 1) {
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
SEPARATE_ZVAL_IF_NOT_REF(value);
(*value)->is_ref = 1;
}
if (!use_key) {
if (opline->extended_value & 1) {
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
EX_T(opline->result.u.var).var.ptr_ptr = value;
(*value)->refcount++;
} else {