Skip to content

Commit 63ec474

Browse files
committed
Revert "Zend/zend_rc_debug: convert ZEND_RC_MOD_CHECK() to function"
This reverts commit e509a66.
1 parent e2cd7de commit 63ec474

File tree

2 files changed

+11
-31
lines changed

2 files changed

+11
-31
lines changed

Zend/zend_rc_debug.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,5 @@
1717
#include "zend_rc_debug.h"
1818

1919
#if ZEND_RC_DEBUG
20-
21-
#include "zend_types.h"
22-
2320
ZEND_API bool zend_rc_debug = false;
24-
25-
ZEND_API void ZEND_RC_MOD_CHECK(const zend_refcounted_h *p)
26-
{
27-
if (!zend_rc_debug) {
28-
return;
29-
}
30-
31-
uint8_t type = zval_gc_type(p->u.type_info);
32-
33-
/* Skip checks for OBJECT/NULL type to avoid interpreting the flag incorrectly. */
34-
if (type != IS_OBJECT && type != IS_NULL) {
35-
ZEND_ASSERT(!(zval_gc_flags(p->u.type_info) & GC_IMMUTABLE));
36-
37-
/* The GC_PERSISTENT flag is reused for IS_OBJ_WEAKLY_REFERENCED on objects. */
38-
ZEND_ASSERT((zval_gc_flags(p->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT);
39-
}
40-
}
41-
4221
#endif

Zend/zend_rc_debug.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@
3232
#include <stdbool.h>
3333
#include <stdint.h>
3434

35-
#include "zend_portability.h"
36-
37-
typedef struct _zend_refcounted_h zend_refcounted_h;
38-
3935
extern ZEND_API bool zend_rc_debug;
4036

41-
BEGIN_EXTERN_C()
42-
43-
ZEND_API void ZEND_RC_MOD_CHECK(const zend_refcounted_h *p);
44-
45-
END_EXTERN_C()
46-
37+
/* The GC_PERSISTENT flag is reused for IS_OBJ_WEAKLY_REFERENCED on objects.
38+
* Skip checks for OBJECT/NULL type to avoid interpreting the flag incorrectly. */
39+
# define ZEND_RC_MOD_CHECK(p) do { \
40+
if (zend_rc_debug) { \
41+
uint8_t type = zval_gc_type((p)->u.type_info); \
42+
if (type != IS_OBJECT && type != IS_NULL) { \
43+
ZEND_ASSERT(!(zval_gc_flags((p)->u.type_info) & GC_IMMUTABLE)); \
44+
ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT); \
45+
} \
46+
} \
47+
} while (0)
4748
#else
4849
# define ZEND_RC_MOD_CHECK(p) \
4950
do { } while (0)

0 commit comments

Comments
 (0)