File tree Expand file tree Collapse file tree 2 files changed +11
-31
lines changed Expand file tree Collapse file tree 2 files changed +11
-31
lines changed Original file line number Diff line number Diff line change 17
17
#include "zend_rc_debug.h"
18
18
19
19
#if ZEND_RC_DEBUG
20
-
21
- #include "zend_types.h"
22
-
23
20
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
-
42
21
#endif
Original file line number Diff line number Diff line change 32
32
#include <stdbool.h>
33
33
#include <stdint.h>
34
34
35
- #include "zend_portability.h"
36
-
37
- typedef struct _zend_refcounted_h zend_refcounted_h ;
38
-
39
35
extern ZEND_API bool zend_rc_debug ;
40
36
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)
47
48
#else
48
49
# define ZEND_RC_MOD_CHECK (p ) \
49
50
do { } while (0)
You can’t perform that action at this time.
0 commit comments