From: Mathieu Desnoyers Date: Wed, 8 Sep 2021 20:07:35 +0000 (-0400) Subject: lfstack C++ API: implement overloaded wrappers with templates X-Git-Tag: v0.14.0~54 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9298902cee251b178bafe4f66aed7e0e6665d316;p=userspace-rcu.git lfstack C++ API: implement overloaded wrappers with templates Signed-off-by: Mathieu Desnoyers Change-Id: I1bcfd8f0bab53e30778f7d20e374de750ebdf806 --- diff --git a/include/urcu/lfstack.h b/include/urcu/lfstack.h index 3b5034f..b994ea6 100644 --- a/include/urcu/lfstack.h +++ b/include/urcu/lfstack.h @@ -281,44 +281,23 @@ static inline cds_lfs_stack_ptr_t cds_lfs_stack_cast(struct cds_lfs_stack *s) return ret; } -static inline bool cds_lfs_empty(struct __cds_lfs_stack *s) +template static inline bool cds_lfs_empty(T s) { return cds_lfs_empty(cds_lfs_stack_cast(s)); } -static inline bool cds_lfs_empty(struct cds_lfs_stack *s) -{ - return cds_lfs_empty(cds_lfs_stack_cast(s)); -} - -static inline bool cds_lfs_push(struct __cds_lfs_stack *s, - struct cds_lfs_node *node) -{ - return cds_lfs_push(cds_lfs_stack_cast(s), node); -} - -static inline bool cds_lfs_push(struct cds_lfs_stack *s, +template static inline bool cds_lfs_push(T s, struct cds_lfs_node *node) { return cds_lfs_push(cds_lfs_stack_cast(s), node); } -static inline struct cds_lfs_node *__cds_lfs_pop(struct __cds_lfs_stack *s) +template static inline struct cds_lfs_node *__cds_lfs_pop(T s) { return __cds_lfs_pop(cds_lfs_stack_cast(s)); } -static inline struct cds_lfs_node *__cds_lfs_pop(struct cds_lfs_stack *s) -{ - return __cds_lfs_pop(cds_lfs_stack_cast(s)); -} - -static inline struct cds_lfs_head *__cds_lfs_pop_all(struct __cds_lfs_stack *s) -{ - return __cds_lfs_pop_all(cds_lfs_stack_cast(s)); -} - -static inline struct cds_lfs_head *__cds_lfs_pop_all(struct cds_lfs_stack *s) +template static inline struct cds_lfs_head *__cds_lfs_pop_all(T s) { return __cds_lfs_pop_all(cds_lfs_stack_cast(s)); }