tree-wide: Introduce DECLARE_TRIVIAL_REF_UNREF_FUNC() and friends

This commit is contained in:
Daan De Meyer
2026-01-02 04:04:19 +09:00
committed by Yu Watanabe
parent 11adc8bad5
commit daff8ea8bb
61 changed files with 109 additions and 144 deletions
+10
View File
@@ -74,6 +74,16 @@ typedef void* (*mfree_func_t)(void *p);
DEFINE_TRIVIAL_REF_FUNC(type, name); \
DEFINE_TRIVIAL_UNREF_FUNC(type, name, free_func);
#define DECLARE_TRIVIAL_REF_FUNC(type, name) \
type* name##_ref(type *p)
#define DECLARE_TRIVIAL_UNREF_FUNC(type, name) \
type* name##_unref(type *p)
#define DECLARE_TRIVIAL_REF_UNREF_FUNC(type, name) \
DECLARE_TRIVIAL_REF_FUNC(type, name); \
DECLARE_TRIVIAL_UNREF_FUNC(type, name)
#define DEFINE_PRIVATE_TRIVIAL_REF_UNREF_FUNC(type, name, free_func) \
DEFINE_PRIVATE_TRIVIAL_REF_FUNC(type, name); \
DEFINE_PRIVATE_TRIVIAL_UNREF_FUNC(type, name, free_func);
+1 -2
View File
@@ -57,8 +57,7 @@ LogContext* log_context_new_iov(struct iovec *input_iovec, size_t n_input_iovec,
LogContext* log_context_new_strv_consume(char **fields);
LogContext* log_context_new_iov_consume(struct iovec *input_iovec, size_t n_input_iovec);
LogContext *log_context_ref(LogContext *c);
LogContext *log_context_unref(LogContext *c);
DECLARE_TRIVIAL_REF_UNREF_FUNC(LogContext, log_context);
DEFINE_TRIVIAL_CLEANUP_FUNC(LogContext*, log_context_unref);