summaryrefslogtreecommitdiff
path: root/lib/openbsd-tree.h
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-01-15 13:34:23 -0500
committerRenato Westphal <renato@opensourcerouting.org>2019-02-11 15:49:49 -0200
commitd01b92fd7507d64bec89350daf725aa6fb9fdcf4 (patch)
treee11fcaa40c9fe08b636f8ca58b786a7766a065ed /lib/openbsd-tree.h
parentfb85ce1b812d892a07a4f942b4cfade9442b9a2b (diff)
libs, daemons: changes to permit c++ compilation
Some misc changes to resolve some c++ compilation errors. The goal is only to permit an external module - a plugin, for example - to see frr headers, not to support or encourage contributions in c++. The changes include: avoiding use of keywords like 'new', 'delete'; cleaning up implicit type-casting from 'void *' in several places. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'lib/openbsd-tree.h')
-rw-r--r--lib/openbsd-tree.h31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/openbsd-tree.h b/lib/openbsd-tree.h
index 1383ef6de0..b3efe4cbd3 100644
--- a/lib/openbsd-tree.h
+++ b/lib/openbsd-tree.h
@@ -397,31 +397,36 @@ int _rb_check(const struct rb_type *, void *, unsigned long);
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_INSERT(struct _name *head, struct _type *elm) \
{ \
- return _rb_insert(_name##_RB_TYPE, &head->rbh_root, elm); \
+ return (struct _type *)_rb_insert( \
+ _name##_RB_TYPE, &head->rbh_root, elm); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_REMOVE(struct _name *head, struct _type *elm) \
{ \
- return _rb_remove(_name##_RB_TYPE, &head->rbh_root, elm); \
+ return (struct _type *)_rb_remove( \
+ _name##_RB_TYPE, &head->rbh_root, elm); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_FIND(struct _name *head, const struct _type *key) \
{ \
- return _rb_find(_name##_RB_TYPE, &head->rbh_root, key); \
+ return (struct _type *)_rb_find( \
+ _name##_RB_TYPE, &head->rbh_root, key); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_NFIND(struct _name *head, const struct _type *key) \
{ \
- return _rb_nfind(_name##_RB_TYPE, &head->rbh_root, key); \
+ return (struct _type *)_rb_nfind( \
+ _name##_RB_TYPE, &head->rbh_root, key); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_ROOT(struct _name *head) \
{ \
- return _rb_root(_name##_RB_TYPE, &head->rbh_root); \
+ return (struct _type *)_rb_root( \
+ _name##_RB_TYPE, &head->rbh_root); \
} \
\
__attribute__((__unused__)) static inline int _name##_RB_EMPTY( \
@@ -433,43 +438,45 @@ int _rb_check(const struct rb_type *, void *, unsigned long);
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_MIN(struct _name *head) \
{ \
- return _rb_min(_name##_RB_TYPE, &head->rbh_root); \
+ return (struct _type *)_rb_min( \
+ _name##_RB_TYPE, &head->rbh_root); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_MAX(struct _name *head) \
{ \
- return _rb_max(_name##_RB_TYPE, &head->rbh_root); \
+ return (struct _type *)_rb_max( \
+ _name##_RB_TYPE, &head->rbh_root); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_NEXT(struct _type *elm) \
{ \
- return _rb_next(_name##_RB_TYPE, elm); \
+ return (struct _type *)_rb_next(_name##_RB_TYPE, elm); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_PREV(struct _type *elm) \
{ \
- return _rb_prev(_name##_RB_TYPE, elm); \
+ return (struct _type *)_rb_prev(_name##_RB_TYPE, elm); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_LEFT(struct _type *elm) \
{ \
- return _rb_left(_name##_RB_TYPE, elm); \
+ return (struct _type *)_rb_left(_name##_RB_TYPE, elm); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_RIGHT(struct _type *elm) \
{ \
- return _rb_right(_name##_RB_TYPE, elm); \
+ return (struct _type *)_rb_right(_name##_RB_TYPE, elm); \
} \
\
__attribute__((__unused__)) static inline struct _type \
*_name##_RB_PARENT(struct _type *elm) \
{ \
- return _rb_parent(_name##_RB_TYPE, elm); \
+ return (struct _type *)_rb_parent(_name##_RB_TYPE, elm); \
} \
\
__attribute__((__unused__)) static inline void _name##_RB_SET_LEFT( \