diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2019-03-02 15:00:46 -0300 |
|---|---|---|
| committer | Renato Westphal <renatowestphal@gmail.com> | 2019-03-29 11:32:21 -0300 |
| commit | 8f88441d717c0ded412543cceabf0ddd93ee9f09 (patch) | |
| tree | 0a460d2da46a5b910535529c92e8db2fa5ff2a74 /lib/openbsd-tree.h | |
| parent | 6a534dcafcb623f1b85b5ee2a13c74faab227ced (diff) | |
| parent | 700e9faa28bbdc3460e1d7aa109b6e4acaf347b3 (diff) | |
Merge remote-tracking branch 'frr/master' into rip-vrf
Merge commit to solve a bunch of conflicts with other PRs that were
merged in the previous weeks.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/openbsd-tree.h')
| -rw-r--r-- | lib/openbsd-tree.h | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/lib/openbsd-tree.h b/lib/openbsd-tree.h index 1383ef6de0..d2f0781333 100644 --- a/lib/openbsd-tree.h +++ b/lib/openbsd-tree.h @@ -27,6 +27,10 @@ #ifndef _SYS_TREE_H_ #define _SYS_TREE_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* * This file defines data structures for different types of trees: * splay trees and red-black trees. @@ -397,31 +401,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 +442,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( \ @@ -560,4 +571,8 @@ int _rb_check(const struct rb_type *, void *, unsigned long); for ((_e) = RB_MAX(_name, (_head)); \ (_e) != NULL && ((_n) = RB_PREV(_name, (_e)), 1); (_e) = (_n)) +#ifdef __cplusplus +} +#endif + #endif /* _SYS_TREE_H_ */ |
