lfstack C++ API: implement overloaded wrappers with templates
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 8 Sep 2021 20:07:35 +0000 (16:07 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 8 Sep 2021 20:07:35 +0000 (16:07 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1bcfd8f0bab53e30778f7d20e374de750ebdf806

include/urcu/lfstack.h

index 3b5034fc99a36a7433dfb90e12667028ec454f4c..b994ea6b5385285d7357da5c0a3fb2fc74eea257 100644 (file)
@@ -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<typename T> 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<typename T> 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<typename T> 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<typename T> static inline struct cds_lfs_head *__cds_lfs_pop_all(T s)
 {
        return __cds_lfs_pop_all(cds_lfs_stack_cast(s));
 }
This page took 0.039353 seconds and 4 git commands to generate.