Skip to content

Commit 3590890

Browse files
authored
Fix duplicate pattern usage in Z_TRY_(ADD|DEL)REF_P (GH-17097)
GCC produces exactly the same binary with and without this change (without extensions), which demonstrates two things: * There is no additional register pressure. * All usages of the macros were correct in older branches, i.e. the expressions did not have any side-effects.
1 parent 5a482a1 commit 3590890

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Zend/zend_types.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,14 +1273,16 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
12731273
#define Z_DELREF(z) Z_DELREF_P(&(z))
12741274

12751275
#define Z_TRY_ADDREF_P(pz) do { \
1276-
if (Z_REFCOUNTED_P((pz))) { \
1277-
Z_ADDREF_P((pz)); \
1276+
zval *_pz = (pz); \
1277+
if (Z_REFCOUNTED_P(_pz)) { \
1278+
Z_ADDREF_P(_pz); \
12781279
} \
12791280
} while (0)
12801281

12811282
#define Z_TRY_DELREF_P(pz) do { \
1282-
if (Z_REFCOUNTED_P((pz))) { \
1283-
Z_DELREF_P((pz)); \
1283+
zval *_pz = (pz); \
1284+
if (Z_REFCOUNTED_P(_pz)) { \
1285+
Z_DELREF_P(_pz); \
12841286
} \
12851287
} while (0)
12861288

0 commit comments

Comments
 (0)