19#define REF_MAGIC 0x26CB6E4C
54#define DEREF_DEFER(ptr) __attribute__((cleanup(ref_defer_cleanup))) void* CONCAT(p, __COUNTER__) = (ptr)
67 ref_t* ref = (ref_t*)ptr; \
82 ref_t* ref = (ref_t*)ptr; \
#define assert(expression)
static void ref_defer_cleanup(void **ptr)
static void ref_dec(void *ptr)
Decrement reference count.
static void ref_init(ref_t *ref, void *free)
Initialize a reference counter.
#define REF_MAGIC
Magic value used in debug builds to check for corruption or invalid use of the ref_t structure.
static void * ref_inc(void *ptr)
Increment reference count.
#define NULL
Pointer error value.
#define atomic_fetch_add_explicit(object, operand, order)
#define atomic_thread_fence(order)
#define atomic_init(obj, value)
#define atomic_fetch_sub_explicit(object, operand, order)
_PUBLIC void free(void *ptr)
Reference counting structure.
atomic_uint32_t count
Atomic reference counter.
void(* free)(void *self)
Cleanup function called when count reaches zero.
uint32_t magic
Debug magic value to detect corruption.