Skip to content

Commit 49d90dc

Browse files
committed
Add Z_EXTRA macro
For use with u2 values which don't deserve a custom macro...
1 parent 8d8e949 commit 49d90dc

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Zend/zend_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ struct _zval_struct {
139139
uint32_t fe_iter_idx; /* foreach iterator index */
140140
uint32_t access_flags; /* class constant access flags */
141141
uint32_t property_guard; /* single property guard */
142+
uint32_t extra; /* not further specified */
142143
} u2;
143144
};
144145

@@ -364,6 +365,9 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
364365
#define Z_ACCESS_FLAGS(zval) (zval).u2.access_flags
365366
#define Z_ACCESS_FLAGS_P(zval_p) Z_ACCESS_FLAGS(*(zval_p))
366367

368+
#define Z_EXTRA(zval) (zval).u2.extra
369+
#define Z_EXTRA_P(zval_p) Z_EXTRA(*(zval_p))
370+
367371
#define Z_COUNTED(zval) (zval).value.counted
368372
#define Z_COUNTED_P(zval_p) Z_COUNTED(*(zval_p))
369373

ext/standard/var_unserializer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ PHPAPI zval *var_tmp_var(php_unserialize_data_t *var_hashx)
142142
(*var_hashx)->last_dtor = var_hash;
143143
}
144144
ZVAL_UNDEF(&var_hash->data[var_hash->used_slots]);
145-
Z_ACCESS_FLAGS(var_hash->data[var_hash->used_slots]) = 0;
145+
Z_EXTRA(var_hash->data[var_hash->used_slots]) = 0;
146146
return &var_hash->data[var_hash->used_slots++];
147147
}
148148

@@ -212,7 +212,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
212212
#endif
213213

214214
/* Perform delayed __wakeup calls */
215-
if (Z_ACCESS_FLAGS_P(zv) == VAR_WAKEUP_FLAG) {
215+
if (Z_EXTRA_P(zv) == VAR_WAKEUP_FLAG) {
216216
if (!wakeup_failed) {
217217
zval retval;
218218
if (Z_ISUNDEF(wakeup_name)) {
@@ -562,7 +562,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements)
562562
/* Delay __wakeup call until end of serialization */
563563
zval *wakeup_var = var_tmp_var(var_hash);
564564
ZVAL_COPY(wakeup_var, rval);
565-
Z_ACCESS_FLAGS_P(wakeup_var) = VAR_WAKEUP_FLAG;
565+
Z_EXTRA_P(wakeup_var) = VAR_WAKEUP_FLAG;
566566
}
567567

568568
return finish_nested_data(UNSERIALIZE_PASSTHRU);

ext/standard/var_unserializer.re

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ PHPAPI zval *var_tmp_var(php_unserialize_data_t *var_hashx)
140140
(*var_hashx)->last_dtor = var_hash;
141141
}
142142
ZVAL_UNDEF(&var_hash->data[var_hash->used_slots]);
143-
Z_ACCESS_FLAGS(var_hash->data[var_hash->used_slots]) = 0;
143+
Z_EXTRA(var_hash->data[var_hash->used_slots]) = 0;
144144
return &var_hash->data[var_hash->used_slots++];
145145
}
146146

@@ -210,7 +210,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
210210
#endif
211211

212212
/* Perform delayed __wakeup calls */
213-
if (Z_ACCESS_FLAGS_P(zv) == VAR_WAKEUP_FLAG) {
213+
if (Z_EXTRA_P(zv) == VAR_WAKEUP_FLAG) {
214214
if (!wakeup_failed) {
215215
zval retval;
216216
if (Z_ISUNDEF(wakeup_name)) {
@@ -566,7 +566,7 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements)
566566
/* Delay __wakeup call until end of serialization */
567567
zval *wakeup_var = var_tmp_var(var_hash);
568568
ZVAL_COPY(wakeup_var, rval);
569-
Z_ACCESS_FLAGS_P(wakeup_var) = VAR_WAKEUP_FLAG;
569+
Z_EXTRA_P(wakeup_var) = VAR_WAKEUP_FLAG;
570570
}
571571

572572
return finish_nested_data(UNSERIALIZE_PASSTHRU);

0 commit comments

Comments
 (0)