From 1b9189d5fdab672f91600b7e72a1deeab277eafc Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 9 Mar 2022 12:30:05 +0100 Subject: Route validity check converted to generic macro dispatch --- nest/route.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nest/route.h') diff --git a/nest/route.h b/nest/route.h index ade14857..4944a854 100644 --- a/nest/route.h +++ b/nest/route.h @@ -259,7 +259,10 @@ struct rte_storage { #define REF_MODIFY 16 /* Route is scheduled for modify */ /* Route is valid for propagation (may depend on other flags in the future), accepts NULL */ -static inline int rte_is_valid(rte *r) { return r && !(r->flags & REF_FILTERED); } +static inline int rte_is_valid_rte(rte *r) { return r && !(r->flags & REF_FILTERED); } +static inline int rte_is_valid_storage(struct rte_storage *r) { return r && rte_is_valid_rte(&r->rte); } + +#define rte_is_valid(r) _Generic((*r), rte: rte_is_valid_rte, struct rte_storage: rte_is_valid_storage)(r) /* Route just has REF_FILTERED flag */ static inline int rte_is_filtered(rte *r) { return !!(r->flags & REF_FILTERED); } -- cgit v1.2.3