diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/thread.c | 4 | ||||
| -rw-r--r-- | lib/typerb.h | 8 | ||||
| -rw-r--r-- | lib/typesafe.h | 14 |
3 files changed, 21 insertions, 5 deletions
diff --git a/lib/thread.c b/lib/thread.c index 9489e3e923..7a9a0ab608 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1034,7 +1034,7 @@ static void do_thread_cancel(struct thread_master *master) if (cr->eventobj) { struct thread *t; - for_each_safe(thread_list, &master->event, t) { + frr_each_safe(thread_list, &master->event, t) { if (t->arg != cr->eventobj) continue; thread_list_del(&master->event, t); @@ -1043,7 +1043,7 @@ static void do_thread_cancel(struct thread_master *master) thread_add_unuse(master, t); } - for_each_safe(thread_list, &master->ready, t) { + frr_each_safe(thread_list, &master->ready, t) { if (t->arg != cr->eventobj) continue; thread_list_del(&master->ready, t); diff --git a/lib/typerb.h b/lib/typerb.h index 3d8db06fe0..ce8446f853 100644 --- a/lib/typerb.h +++ b/lib/typerb.h @@ -22,6 +22,10 @@ #include "typesafe.h" +#ifdef __cplusplus +extern "C" { +#endif + struct typed_rb_entry { struct typed_rb_entry *rbt_parent; struct typed_rb_entry *rbt_left; @@ -179,4 +183,8 @@ macro_inline int prefix ## __cmp_uq(const struct typed_rb_entry *a, \ _DECLARE_RBTREE(prefix, type, field, prefix ## __cmp, prefix ## __cmp_uq) \ /* ... */ +#ifdef __cplusplus +} +#endif + #endif /* _FRR_TYPERB_H */ diff --git a/lib/typesafe.h b/lib/typesafe.h index 6df3a07efe..0a4ed69e4e 100644 --- a/lib/typesafe.h +++ b/lib/typesafe.h @@ -23,19 +23,23 @@ #include <assert.h> #include "compiler.h" +#ifdef __cplusplus +extern "C" { +#endif + /* generic macros for all list-like types */ -#define for_each(prefix, head, item) \ +#define frr_each(prefix, head, item) \ for (item = prefix##_first(head); item; \ item = prefix##_next(head, item)) -#define for_each_safe(prefix, head, item) \ +#define frr_each_safe(prefix, head, item) \ for (typeof(prefix##_next_safe(head, NULL)) prefix##_safe = \ prefix##_next_safe(head, \ (item = prefix##_first(head))); \ item; \ item = prefix##_safe, \ prefix##_safe = prefix##_next_safe(head, prefix##_safe)) -#define for_each_from(prefix, head, item, from) \ +#define frr_each_from(prefix, head, item, from) \ for (item = from, from = prefix##_next_safe(head, item); \ item; \ item = from, from = prefix##_next_safe(head, from)) @@ -850,6 +854,10 @@ extern void typesafe_skiplist_del(struct sskip_head *head, const struct sskip_item *b)); extern struct sskip_item *typesafe_skiplist_pop(struct sskip_head *head); +#ifdef __cplusplus +} +#endif + /* this needs to stay at the end because both files include each other. * the resolved order is typesafe.h before typerb.h */ |
