lib: make rcu_free() NULL-safe

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2019-11-13 15:42:32 +01:00
parent 420dcec358
commit 9fe602a17c

View File

@ -139,6 +139,8 @@ extern void rcu_enqueue(struct rcu_head *head, const struct rcu_action *action);
#define rcu_free(mtype, ptr, field) \ #define rcu_free(mtype, ptr, field) \
do { \ do { \
typeof(ptr) _ptr = (ptr); \ typeof(ptr) _ptr = (ptr); \
if (!_ptr) \
break; \
struct rcu_head *_rcu_head = &_ptr->field; \ struct rcu_head *_rcu_head = &_ptr->field; \
static const struct rcu_action _rcu_action = { \ static const struct rcu_action _rcu_action = { \
.type = RCUA_FREE, \ .type = RCUA_FREE, \