Again, see previous commits.
Signed-off-by: David Lamparter <equinox@diac24.net>
#include "lib/typesafe.h"
-PREDECL_DLIST(bgp_adv_fifo)
+PREDECL_DLIST(bgp_adv_fifo);
struct update_subgroup;
struct bgp_path_info *pathi;
};
-DECLARE_DLIST(bgp_adv_fifo, struct bgp_advertise, fifo)
+DECLARE_DLIST(bgp_adv_fifo, struct bgp_advertise, fifo);
/* BGP adjacency out. */
struct bgp_adj_out {
return jhash(&e->bgp, sizeof(e->bgp), 0x55aa5a5a);
}
-DECLARE_HASH(bmp_bgph, struct bmp_bgp, bbi, bmp_bgp_cmp, bmp_bgp_hash)
+DECLARE_HASH(bmp_bgph, struct bmp_bgp, bbi, bmp_bgp_cmp, bmp_bgp_hash);
struct bmp_bgph_head bmp_bgph;
}
DECLARE_HASH(bmp_peerh, struct bmp_bgp_peer, bpi,
- bmp_bgp_peer_cmp, bmp_bgp_peer_hash)
+ bmp_bgp_peer_cmp, bmp_bgp_peer_hash);
struct bmp_peerh_head bmp_peerh;
-DECLARE_LIST(bmp_mirrorq, struct bmp_mirrorq, bmi)
+DECLARE_LIST(bmp_mirrorq, struct bmp_mirrorq, bmi);
/* listener management */
return 0;
}
-DECLARE_SORTLIST_UNIQ(bmp_listeners, struct bmp_listener, bli, bmp_listener_cmp)
+DECLARE_SORTLIST_UNIQ(bmp_listeners, struct bmp_listener, bli,
+ bmp_listener_cmp);
static int bmp_targets_cmp(const struct bmp_targets *a,
const struct bmp_targets *b)
return strcmp(a->name, b->name);
}
-DECLARE_SORTLIST_UNIQ(bmp_targets, struct bmp_targets, bti, bmp_targets_cmp)
+DECLARE_SORTLIST_UNIQ(bmp_targets, struct bmp_targets, bti, bmp_targets_cmp);
-DECLARE_LIST(bmp_session, struct bmp, bsi)
+DECLARE_LIST(bmp_session, struct bmp, bsi);
-DECLARE_DLIST(bmp_qlist, struct bmp_queue_entry, bli)
+DECLARE_DLIST(bmp_qlist, struct bmp_queue_entry, bli);
static int bmp_qhash_cmp(const struct bmp_queue_entry *a,
const struct bmp_queue_entry *b)
}
DECLARE_HASH(bmp_qhash, struct bmp_queue_entry, bhi,
- bmp_qhash_cmp, bmp_qhash_hkey)
+ bmp_qhash_cmp, bmp_qhash_hkey);
static int bmp_active_cmp(const struct bmp_active *a,
const struct bmp_active *b)
return 0;
}
-DECLARE_SORTLIST_UNIQ(bmp_actives, struct bmp_active, bai, bmp_active_cmp)
+DECLARE_SORTLIST_UNIQ(bmp_actives, struct bmp_active, bai, bmp_active_cmp);
static struct bmp *bmp_new(struct bmp_targets *bt, int bmp_sock)
{
* always happens from the front of the queue.)
*/
-PREDECL_DLIST(bmp_qlist)
-PREDECL_HASH(bmp_qhash)
+PREDECL_DLIST(bmp_qlist);
+PREDECL_HASH(bmp_qhash);
struct bmp_queue_entry {
struct bmp_qlist_item bli;
* with a size limit. Refcount works the same as for monitoring above.
*/
-PREDECL_LIST(bmp_mirrorq)
+PREDECL_LIST(bmp_mirrorq);
struct bmp_mirrorq {
struct bmp_mirrorq_item bmi;
BMP_AFI_LIVE,
};
-PREDECL_LIST(bmp_session)
+PREDECL_LIST(bmp_session);
struct bmp_active;
struct bmp_targets;
* succeeds, "bmp" is set up.
*/
-PREDECL_SORTLIST_UNIQ(bmp_actives)
+PREDECL_SORTLIST_UNIQ(bmp_actives);
#define BMP_DFLT_MINRETRY 30000
#define BMP_DFLT_MAXRETRY 720000
};
/* config & state for passive / listening sockets */
-PREDECL_SORTLIST_UNIQ(bmp_listeners)
+PREDECL_SORTLIST_UNIQ(bmp_listeners);
struct bmp_listener {
struct bmp_listeners_item bli;
* bmp_active items. If they have the same config, BMP session should be
* put in the same targets since that's a bit more effective.
*/
-PREDECL_SORTLIST_UNIQ(bmp_targets)
+PREDECL_SORTLIST_UNIQ(bmp_targets);
struct bmp_targets {
struct bmp_targets_item bti;
/* per struct peer * data. Lookup by peer->qobj_node.nid, created on demand,
* deleted in peer_backward hook. */
-PREDECL_HASH(bmp_peerh)
+PREDECL_HASH(bmp_peerh);
struct bmp_bgp_peer {
struct bmp_peerh_item bpi;
};
/* per struct bgp * data */
-PREDECL_HASH(bmp_bgph)
+PREDECL_HASH(bmp_bgph);
#define BMP_PEER_DOWN_NO_RELEVANT_EVENT_CODE 0x00
struct lp_lcb lcb;
};
-DECLARE_LIST(lp_fifo, struct lp_fifo, fifo)
+DECLARE_LIST(lp_fifo, struct lp_fifo, fifo);
struct lp_cbq_item {
int (*cbfunc)(mpls_label_t label, void *lblid, bool alloc);
#define LP_TYPE_VRF 0x00000001
#define LP_TYPE_BGP_LU 0x00000002
-PREDECL_LIST(lp_fifo)
+PREDECL_LIST(lp_fifo);
struct labelpool {
struct skiplist *ledger; /* all requests */
#include <typesafe.h>
- PREDECL_XXX(Z)
+ PREDECL_XXX(Z);
struct item {
int otherdata;
struct Z_item mylistitem;
struct Z_head mylisthead;
/* unsorted: */
- DECLARE_XXX(Z, struct item, mylistitem)
+ DECLARE_XXX(Z, struct item, mylistitem);
/* sorted, items that compare as equal cannot be added to list */
int compare_func(const struct item *a, const struct item *b);
- DECLARE_XXX_UNIQ(Z, struct item, mylistitem, compare_func)
+ DECLARE_XXX_UNIQ(Z, struct item, mylistitem, compare_func);
/* sorted, items that compare as equal can be added to list */
int compare_func(const struct item *a, const struct item *b);
- DECLARE_XXX_NONUNIQ(Z, struct item, mylistitem, compare_func)
+ DECLARE_XXX_NONUNIQ(Z, struct item, mylistitem, compare_func);
/* hash tables: */
int compare_func(const struct item *a, const struct item *b);
uint32_t hash_func(const struct item *a);
- DECLARE_XXX(Z, struct item, mylistitem, compare_func, hash_func)
+ DECLARE_XXX(Z, struct item, mylistitem, compare_func, hash_func);
``XXX`` is replaced with the name of the data structure, e.g. ``SKIPLIST``
or ``ATOMLIST``. The ``DECLARE_XXX`` invocation can either occur in a `.h`
#include "lib/typesafe.h"
#include "lib/zclient.h"
-PREDECL_RBTREE_UNIQ(lfa_tiebreaker_tree)
-PREDECL_RBTREE_UNIQ(rlfa_tree)
+PREDECL_RBTREE_UNIQ(lfa_tiebreaker_tree);
+PREDECL_RBTREE_UNIQ(rlfa_tree);
enum lfa_tiebreaker_type {
LFA_TIEBREAKER_DOWNSTREAM = 0,
int lfa_tiebreaker_cmp(const struct lfa_tiebreaker *a,
const struct lfa_tiebreaker *b);
DECLARE_RBTREE_UNIQ(lfa_tiebreaker_tree, struct lfa_tiebreaker, entry,
- lfa_tiebreaker_cmp)
+ lfa_tiebreaker_cmp);
struct rlfa {
struct rlfa_tree_item entry;
struct in_addr pq_address;
};
int rlfa_cmp(const struct rlfa *a, const struct rlfa *b);
-DECLARE_RBTREE_UNIQ(rlfa_tree, struct rlfa, entry, rlfa_cmp)
+DECLARE_RBTREE_UNIQ(rlfa_tree, struct rlfa, entry, rlfa_cmp);
enum isis_tilfa_sid_type {
TILFA_SID_PREFIX = 1,
#include "lib/typesafe.h"
#include "isisd/isis_pdu.h"
-PREDECL_RBTREE_UNIQ(lspdb)
+PREDECL_RBTREE_UNIQ(lspdb);
struct isis;
/* Structure for isis_lsp, this structure will only support the fixed
};
extern int lspdb_compare(const struct isis_lsp *a, const struct isis_lsp *b);
-DECLARE_RBTREE_UNIQ(lspdb, struct isis_lsp, dbe, lspdb_compare)
+DECLARE_RBTREE_UNIQ(lspdb, struct isis_lsp, dbe, lspdb_compare);
void lsp_db_init(struct lspdb_head *head);
void lsp_db_fini(struct lspdb_head *head);
return prefix_cmp(&a->prefix, &b->prefix);
}
DECLARE_RBTREE_UNIQ(srdb_prefix_cfg, struct sr_prefix_cfg, entry,
- sr_prefix_sid_cfg_compare)
+ sr_prefix_sid_cfg_compare);
/**
* Find SRGB associated to a System ID.
#define SRLB_UPPER_BOUND 15999
/* Segment Routing Data Base (SRDB) RB-Tree structure */
-PREDECL_RBTREE_UNIQ(srdb_prefix_cfg)
+PREDECL_RBTREE_UNIQ(srdb_prefix_cfg);
/*
* Segment Routing Prefix-SID information.
/* use as:
*
- * PREDECL_ATOMLIST(namelist)
+ * PREDECL_ATOMLIST(namelist);
* struct name {
* struct namelist_item nlitem;
* }
- * DECLARE_ATOMLIST(namelist, struct name, nlitem)
+ * DECLARE_ATOMLIST(namelist, struct name, nlitem);
*/
#define PREDECL_ATOMLIST(prefix) \
struct prefix ## _head { struct atomlist_head ah; }; \
-struct prefix ## _item { struct atomlist_item ai; };
+struct prefix ## _item { struct atomlist_item ai; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_ATOMLIST(var) { }
assert(prefix ## _count(h) == 0); \
memset(h, 0, sizeof(*h)); \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
/* add_head:
* - contention on ->first pointer
#define _PREDECL_ATOMSORT(prefix) \
struct prefix ## _head { struct atomsort_head ah; }; \
-struct prefix ## _item { struct atomsort_item ai; };
+struct prefix ## _item { struct atomsort_item ai; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_ATOMSORT_UNIQ(var) { }
#define INIT_ATOMSORT_NONUNIQ(var) { }
struct atomsort_item *p = atomsort_pop(&h->ah); \
return p ? container_of(p, type, field.ai) : NULL; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
#define PREDECL_ATOMSORT_UNIQ(prefix) \
_PREDECL_ATOMSORT(prefix)
} \
\
_DECLARE_ATOMSORT(prefix, type, field, \
- prefix ## __cmp, prefix ## __cmp) \
+ prefix ## __cmp, prefix ## __cmp); \
\
atomic_find_warn \
macro_inline type *prefix ## _find(struct prefix##_head *h, const type *item) \
return NULL; \
return p; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
#define PREDECL_ATOMSORT_NONUNIQ(prefix) \
_PREDECL_ATOMSORT(prefix)
} \
\
_DECLARE_ATOMSORT(prefix, type, field, \
- prefix ## __cmp, prefix ## __cmp_uq) \
-/* ... */
+ prefix ## __cmp, prefix ## __cmp_uq); \
+MACRO_REQUIRE_SEMICOLON() /* end */
struct atomsort_item *atomsort_add(struct atomsort_head *h,
struct atomsort_item *item, int (*cmpfn)(
static struct debug_cb_list_head cb_head;
-DECLARE_LIST(debug_cb_list, struct debug_callbacks, item)
+DECLARE_LIST(debug_cb_list, struct debug_callbacks, item);
/* All code in this section should be reentrant and MT-safe */
const char *desc;
};
-PREDECL_LIST(debug_cb_list)
+PREDECL_LIST(debug_cb_list);
/*
* Callback set for debugging code.
*
struct elfreloc;
struct elfsect;
-PREDECL_HASH(elfrelocs)
+PREDECL_HASH(elfrelocs);
/* ELFFile and ELFSection intentionally share some behaviour, particularly
* subscript[123:456] access to file data. This is because relocatables
static uint32_t elfreloc_hash(const struct elfreloc *reloc);
DECLARE_HASH(elfrelocs, struct elfreloc, elfrelocs_item,
- elfreloc_cmp, elfreloc_hash)
+ elfreloc_cmp, elfreloc_hash);
static Elf_Scn *elf_find_addr(struct elffile *ef, uint64_t addr, size_t *idx);
static PyObject *elffile_secbyidx(struct elffile *w, Elf_Scn *scn, size_t idx);
DEFINE_MTYPE_STATIC(LIB, RCU_THREAD, "RCU thread");
DEFINE_MTYPE_STATIC(LIB, RCU_NEXT, "RCU sequence barrier");
-DECLARE_ATOMLIST(rcu_heads, struct rcu_head, head)
+DECLARE_ATOMLIST(rcu_heads, struct rcu_head, head);
-PREDECL_ATOMLIST(rcu_threads)
+PREDECL_ATOMLIST(rcu_threads);
struct rcu_thread {
struct rcu_threads_item head;
/* only accessed by thread itself, not atomic */
unsigned depth;
};
-DECLARE_ATOMLIST(rcu_threads, struct rcu_thread, head)
+DECLARE_ATOMLIST(rcu_threads, struct rcu_thread, head);
static const struct rcu_action rcua_next = { .type = RCUA_NEXT };
static const struct rcu_action rcua_end = { .type = RCUA_END };
};
/* RCU cleanup function queue item */
-PREDECL_ATOMLIST(rcu_heads)
+PREDECL_ATOMLIST(rcu_heads);
struct rcu_head {
struct rcu_heads_item head;
const struct rcu_action *action;
*/
/* Link State Vertex structure */
-PREDECL_RBTREE_UNIQ(vertices)
+PREDECL_RBTREE_UNIQ(vertices);
struct ls_vertex {
struct vertices_item entry; /* Entry in RB Tree */
uint64_t key; /* Unique Key identifier */
};
/* Link State Edge structure */
-PREDECL_RBTREE_UNIQ(edges)
+PREDECL_RBTREE_UNIQ(edges);
struct ls_edge {
struct edges_item entry; /* Entry in RB tree */
uint64_t key; /* Unique Key identifier */
};
/* Link State Subnet structure */
-PREDECL_RBTREE_UNIQ(subnets)
+PREDECL_RBTREE_UNIQ(subnets);
struct ls_subnet {
struct subnets_item entry; /* Entry in RB tree */
struct prefix key; /* Unique Key identifier */
{
return (node1->key - node2->key);
}
-DECLARE_RBTREE_UNIQ(vertices, struct ls_vertex, entry, vertex_cmp)
+DECLARE_RBTREE_UNIQ(vertices, struct ls_vertex, entry, vertex_cmp);
macro_inline int edge_cmp(const struct ls_edge *edge1,
const struct ls_edge *edge2)
{
return (edge1->key - edge2->key);
}
-DECLARE_RBTREE_UNIQ(edges, struct ls_edge, entry, edge_cmp)
+DECLARE_RBTREE_UNIQ(edges, struct ls_edge, entry, edge_cmp);
macro_inline int subnet_cmp(const struct ls_subnet *a,
const struct ls_subnet *b)
{
return prefix_cmp(&a->key, &b->key);
}
-DECLARE_RBTREE_UNIQ(subnets, struct ls_subnet, entry, subnet_cmp)
+DECLARE_RBTREE_UNIQ(subnets, struct ls_subnet, entry, subnet_cmp);
/* Link State TED Structure */
struct ls_ted {
}
DECLARE_HASH(qobj_nodes, struct qobj_node, nodehash,
- qobj_cmp, qobj_hash)
+ qobj_cmp, qobj_hash);
static pthread_rwlock_t nodes_lock;
static struct qobj_nodes_head nodes = { };
RESERVED_SPACE_STRUCT(qobj_nodetype_capnp, capnp, 256)
};
-PREDECL_HASH(qobj_nodes)
+PREDECL_HASH(qobj_nodes);
/* anchor to be embedded somewhere in the object's struct */
struct qobj_node {
}
DECLARE_HASH(rn_hash_node, struct route_node, nodehash, route_table_hash_cmp,
- prefix_hash_key)
+ prefix_hash_key);
/*
* route_table_init_with_delegate
*/
route_table_destroy_node_func_t destroy_node;
};
-PREDECL_HASH(rn_hash_node)
+PREDECL_HASH(rn_hash_node);
/* Routing table top structure. */
struct route_table {
DEFINE_MTYPE_STATIC(LIB, THREAD_POLL, "Thread Poll Info");
DEFINE_MTYPE_STATIC(LIB, THREAD_STATS, "Thread stats");
-DECLARE_LIST(thread_list, struct thread, threaditem)
+DECLARE_LIST(thread_list, struct thread, threaditem);
struct cancel_req {
int flags;
return 0;
}
-DECLARE_HEAP(thread_timer_list, struct thread, timeritem, thread_timer_cmp)
+DECLARE_HEAP(thread_timer_list, struct thread, timeritem, thread_timer_cmp);
#if defined(__APPLE__)
#include <mach/mach.h>
#define GETRUSAGE(X) thread_getrusage(X)
-PREDECL_LIST(thread_list)
-PREDECL_HEAP(thread_timer_list)
+PREDECL_LIST(thread_list);
+PREDECL_HEAP(thread_timer_list);
struct fd_handler {
/* number of pfd that fit in the allocated space of pfds. This is a
#define _PREDECL_RBTREE(prefix) \
struct prefix ## _head { struct typed_rb_root rr; }; \
-struct prefix ## _item { struct typed_rb_entry re; };
+struct prefix ## _item { struct typed_rb_entry re; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_RBTREE_UNIQ(var) { }
#define INIT_RBTREE_NONUNIQ(var) { }
{ \
return h->rr.count; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
#define PREDECL_RBTREE_UNIQ(prefix) \
_PREDECL_RBTREE(prefix)
} \
TYPESAFE_FIND(prefix, type) \
\
-_DECLARE_RBTREE(prefix, type, field, prefix ## __cmp, prefix ## __cmp) \
-/* ... */
+_DECLARE_RBTREE(prefix, type, field, prefix ## __cmp, prefix ## __cmp); \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define PREDECL_RBTREE_NONUNIQ(prefix) \
_PREDECL_RBTREE(prefix)
return 0; \
} \
\
-_DECLARE_RBTREE(prefix, type, field, prefix ## __cmp, prefix ## __cmp_uq) \
-/* ... */
+_DECLARE_RBTREE(prefix, type, field, prefix ## __cmp, prefix ## __cmp_uq); \
+MACRO_REQUIRE_SEMICOLON() /* end */
#ifdef __cplusplus
}
/* use as:
*
- * PREDECL_LIST(namelist)
+ * PREDECL_LIST(namelist);
* struct name {
* struct namelist_item nlitem;
* }
- * DECLARE_LIST(namelist, struct name, nlitem)
+ * DECLARE_LIST(namelist, struct name, nlitem);
*/
#define PREDECL_LIST(prefix) \
struct prefix ## _head { struct slist_head sh; }; \
-struct prefix ## _item { struct slist_item si; };
+struct prefix ## _item { struct slist_item si; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_LIST(var) { .sh = { .last_next = &var.sh.first, }, }
{ \
return h->sh.count; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
/* don't use these structs directly */
struct dlist_item {
*/
#define PREDECL_DLIST(prefix) \
struct prefix ## _head { struct dlist_head dh; }; \
-struct prefix ## _item { struct dlist_item di; };
+struct prefix ## _item { struct dlist_item di; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_DLIST(var) { .dh = { \
.hitem = { &var.dh.hitem, &var.dh.hitem }, }, }
{ \
return h->dh.count; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
/* note: heap currently caps out at 4G items */
#define PREDECL_HEAP(prefix) \
struct prefix ## _head { struct heap_head hh; }; \
-struct prefix ## _item { struct heap_item hi; };
+struct prefix ## _item { struct heap_item hi; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_HEAP(var) { }
{ \
return h->hh.count; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
extern void typesafe_heap_resize(struct heap_head *head, bool grow);
extern void typesafe_heap_pushdown(struct heap_head *head, uint32_t index,
*/
#define _PREDECL_SORTLIST(prefix) \
struct prefix ## _head { struct ssort_head sh; }; \
-struct prefix ## _item { struct ssort_item si; };
+struct prefix ## _item { struct ssort_item si; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_SORTLIST_UNIQ(var) { }
#define INIT_SORTLIST_NONUNIQ(var) { }
{ \
return h->sh.count; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
#define DECLARE_SORTLIST_UNIQ(prefix, type, field, cmpfn) \
- _DECLARE_SORTLIST(prefix, type, field, cmpfn, cmpfn) \
+ _DECLARE_SORTLIST(prefix, type, field, cmpfn, cmpfn); \
\
macro_inline const type *prefix ## _const_find(const struct prefix##_head *h, \
const type *item) \
return container_of(sitem, type, field.si); \
} \
TYPESAFE_FIND(prefix, type) \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
#define DECLARE_SORTLIST_NONUNIQ(prefix, type, field, cmpfn) \
macro_inline int _ ## prefix ## _cmp(const type *a, const type *b) \
return 1; \
return 0; \
} \
- _DECLARE_SORTLIST(prefix, type, field, cmpfn, _ ## prefix ## _cmp) \
-/* ... */
+ _DECLARE_SORTLIST(prefix, type, field, cmpfn, _ ## prefix ## _cmp); \
+MACRO_REQUIRE_SEMICOLON() /* end */
/* hash, "sorted" by hash value
*/
#define PREDECL_HASH(prefix) \
struct prefix ## _head { struct thash_head hh; }; \
-struct prefix ## _item { struct thash_item hi; };
+struct prefix ## _item { struct thash_item hi; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_HASH(var) { }
{ \
return h->hh.count; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
/* skiplist, sorted.
* can be used as priority queue with add / pop
*/
#define _PREDECL_SKIPLIST(prefix) \
struct prefix ## _head { struct sskip_head sh; }; \
-struct prefix ## _item { struct sskip_item si; };
+struct prefix ## _item { struct sskip_item si; }; \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define INIT_SKIPLIST_UNIQ(var) { }
#define INIT_SKIPLIST_NONUNIQ(var) { }
{ \
return h->sh.count; \
} \
-/* ... */
+MACRO_REQUIRE_SEMICOLON() /* end */
#define PREDECL_SKIPLIST_UNIQ(prefix) \
_PREDECL_SKIPLIST(prefix)
TYPESAFE_FIND(prefix, type) \
\
_DECLARE_SKIPLIST(prefix, type, field, \
- prefix ## __cmp, prefix ## __cmp) \
-/* ... */
+ prefix ## __cmp, prefix ## __cmp); \
+MACRO_REQUIRE_SEMICOLON() /* end */
#define PREDECL_SKIPLIST_NONUNIQ(prefix) \
_PREDECL_SKIPLIST(prefix)
} \
\
_DECLARE_SKIPLIST(prefix, type, field, \
- prefix ## __cmp, prefix ## __cmp_uq) \
-/* ... */
+ prefix ## __cmp, prefix ## __cmp_uq); \
+MACRO_REQUIRE_SEMICOLON() /* end */
extern struct sskip_item *typesafe_skiplist_add(struct sskip_head *head,
* additional options. It MUST be the first field in that larger struct.
*/
-PREDECL_ATOMLIST(zlog_targets)
+PREDECL_ATOMLIST(zlog_targets);
struct zlog_target {
struct zlog_targets_item head;
return 0;
}
DECLARE_SKIPLIST_NONUNIQ(vertex_pqueue, struct ospf6_vertex, pqi,
- ospf6_vertex_cmp)
+ ospf6_vertex_cmp);
static int ospf6_vertex_id_cmp(void *a, void *b)
{
#define IS_OSPF6_DEBUG_SPF(level) \
(conf_debug_ospf6_spf & OSPF6_DEBUG_SPF_##level)
-PREDECL_SKIPLIST_NONUNIQ(vertex_pqueue)
+PREDECL_SKIPLIST_NONUNIQ(vertex_pqueue);
/* Transit Vertex */
struct ospf6_vertex {
/* type of this vertex */
}
return 0;
}
-DECLARE_SKIPLIST_NONUNIQ(vertex_pqueue, struct vertex, pqi, vertex_cmp)
+DECLARE_SKIPLIST_NONUNIQ(vertex_pqueue, struct vertex, pqi, vertex_cmp);
static void lsdb_clean_stat(struct ospf_lsdb *lsdb)
{
/* The "root" is the node running the SPF calculation */
-PREDECL_SKIPLIST_NONUNIQ(vertex_pqueue)
+PREDECL_SKIPLIST_NONUNIQ(vertex_pqueue);
/* A router or network in an area */
struct vertex {
struct vertex_pqueue_item pqi;
DECLARE_RBTREE_UNIQ(p_spaces, struct p_space, p_spaces_item,
- p_spaces_compare_func)
+ p_spaces_compare_func);
DECLARE_RBTREE_UNIQ(q_spaces, struct q_space, q_spaces_item,
- q_spaces_compare_func)
+ q_spaces_compare_func);
static void
ospf_ti_lfa_generate_p_space(struct ospf_area *area, struct vertex *child,
}
DECLARE_RBTREE_UNIQ(p_spaces, struct p_space, p_spaces_item,
- p_spaces_compare_func)
+ p_spaces_compare_func);
void ospf_process_refresh_data(struct ospf *ospf, bool reset)
{
struct in_addr router_id;
};
-PREDECL_RBTREE_UNIQ(q_spaces)
+PREDECL_RBTREE_UNIQ(q_spaces);
struct q_space {
struct vertex *root;
struct list *vertex_list;
struct q_spaces_item q_spaces_item;
};
-PREDECL_RBTREE_UNIQ(p_spaces)
+PREDECL_RBTREE_UNIQ(p_spaces);
struct p_space {
struct vertex *root;
struct protected_resource *protected_resource;
/* Data Structure Declarations */
DECLARE_HASH(plspid_map, struct plspid_map_data, mi, plspid_map_cmp,
- plspid_map_hash)
+ plspid_map_hash);
DECLARE_HASH(nbkey_map, struct nbkey_map_data, mi, nbkey_map_cmp,
- nbkey_map_hash)
-DECLARE_HASH(req_map, struct req_map_data, mi, req_map_cmp, req_map_hash)
+ nbkey_map_hash);
+DECLARE_HASH(req_map, struct req_map_data, mi, req_map_cmp, req_map_hash);
static inline int req_entry_compare(const struct req_entry *a,
const struct req_entry *b)
PCEP_PCC_OPERATING
};
-PREDECL_HASH(plspid_map)
-PREDECL_HASH(nbkey_map)
-PREDECL_HASH(req_map)
+PREDECL_HASH(plspid_map);
+PREDECL_HASH(nbkey_map);
+PREDECL_HASH(req_map);
struct plspid_map_data {
struct plspid_map_item mi;
installed: indicate if this entry is installed in the kernel.
*/
-PREDECL_RBTREE_UNIQ(rb_pim_oil)
+PREDECL_RBTREE_UNIQ(rb_pim_oil);
struct channel_oil {
struct pim_instance *pim;
extern int pim_channel_oil_compare(const struct channel_oil *c1,
const struct channel_oil *c2);
DECLARE_RBTREE_UNIQ(rb_pim_oil, struct channel_oil, oil_rb,
- pim_channel_oil_compare)
+ pim_channel_oil_compare);
extern struct list *pim_channel_oil_list;
int pim_upstream_compare(const struct pim_upstream *up1,
const struct pim_upstream *up2);
DECLARE_RBTREE_UNIQ(rb_pim_upstream, struct pim_upstream, upstream_rb,
- pim_upstream_compare)
+ pim_upstream_compare);
void pim_upstream_register_reevaluate(struct pim_instance *pim);
#include "lib/zassert.h"
#include "lib/zclient.h"
-PREDECL_RBTREE_UNIQ(footree)
+PREDECL_RBTREE_UNIQ(footree);
struct foo {
int dummy;
struct footree_item item;
{
return memcmp(&a->dummy, &b->dummy, sizeof(a->dummy));
}
-DECLARE_RBTREE_UNIQ(footree, struct foo, item, foocmp)
+DECLARE_RBTREE_UNIQ(footree, struct foo, item, foocmp);
int main(int argc, char **argv)
{
static struct seqlock sqlo;
-PREDECL_ATOMLIST(alist)
-PREDECL_ATOMSORT_UNIQ(asort)
+PREDECL_ATOMLIST(alist);
+PREDECL_ATOMSORT_UNIQ(asort);
struct item {
uint64_t val1;
struct alist_item chain;
struct asort_item sortc;
uint64_t val2;
};
-DECLARE_ATOMLIST(alist, struct item, chain)
+DECLARE_ATOMLIST(alist, struct item, chain);
static int icmp(const struct item *a, const struct item *b);
-DECLARE_ATOMSORT_UNIQ(asort, struct item, sortc, icmp)
+DECLARE_ATOMSORT_UNIQ(asort, struct item, sortc, icmp);
static int icmp(const struct item *a, const struct item *b)
{
#define REALTYPE TYPE
#endif
-PREDECL(REALTYPE, list)
+PREDECL(REALTYPE, list);
struct item {
uint64_t val;
struct list_item itm;
#if IS_HASH(REALTYPE)
static uint32_t list_hash(const struct item *a);
-DECLARE(REALTYPE, list, struct item, itm, list_cmp, list_hash)
+DECLARE(REALTYPE, list, struct item, itm, list_cmp, list_hash);
static uint32_t list_hash(const struct item *a)
{
}
#else
-DECLARE(REALTYPE, list, struct item, itm, list_cmp)
+DECLARE(REALTYPE, list, struct item, itm, list_cmp);
#endif
static int list_cmp(const struct item *a, const struct item *b)
}
#else /* !IS_SORTED */
-DECLARE(REALTYPE, list, struct item, itm)
+DECLARE(REALTYPE, list, struct item, itm);
#endif
#define NITEM 10000
#include "common.h"
DECLARE_RBTREE_UNIQ(p_spaces, struct p_space, p_spaces_item,
- p_spaces_compare_func)
+ p_spaces_compare_func);
DECLARE_RBTREE_UNIQ(q_spaces, struct q_space, q_spaces_item,
- q_spaces_compare_func)
+ q_spaces_compare_func);
static struct ospf *test_init(struct ospf_test_node *root)
{
return string_hash_make(c->name);
}
-DECLARE_LIST(config_master, struct config, rbt_item)
+DECLARE_LIST(config_master, struct config, rbt_item);
DECLARE_HASH(config_master_hash, struct config, hash_item, config_cmp,
- config_hash)
+ config_hash);
/*
* The config_master_head is a list for order of receipt
enum rnh_type { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE };
-PREDECL_LIST(rnh_list)
+PREDECL_LIST(rnh_list);
/* Nexthop structure. */
struct rnh {
#define DISTANCE_INFINITY 255
#define ZEBRA_KERNEL_TABLE_MAX 252 /* support for no more than this rt tables */
-PREDECL_LIST(re_list)
+PREDECL_LIST(re_list);
struct opaque {
uint16_t length;
}
DECLARE_RBTREE_UNIQ(otable, struct other_route_table, next,
- zvrf_other_table_compare_func)
+ zvrf_other_table_compare_func);
extern struct route_table *
zebra_vrf_lookup_table_with_table_id(afi_t afi, safi_t safi, vrf_id_t vrf_id,