summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-01-15 19:34:23 +0100
committerRenato Westphal <renato@opensourcerouting.org>2019-02-11 18:49:49 +0100
commitd01b92fd7507d64bec89350daf725aa6fb9fdcf4 (patch)
treee11fcaa40c9fe08b636f8ca58b786a7766a065ed /lib
parentMerge pull request #3770 from donaldsharp/detailed_debugs (diff)
downloadfrr-d01b92fd7507d64bec89350daf725aa6fb9fdcf4.tar.xz
frr-d01b92fd7507d64bec89350daf725aa6fb9fdcf4.zip
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')
-rw-r--r--lib/if.c4
-rw-r--r--lib/log.h4
-rw-r--r--lib/nexthop_group.h4
-rw-r--r--lib/northbound.c4
-rw-r--r--lib/northbound.h2
-rw-r--r--lib/openbsd-tree.h31
-rw-r--r--lib/srcdest_table.h3
-rw-r--r--lib/table.h7
-rw-r--r--lib/vrf.c4
-rw-r--r--lib/vrf.h2
10 files changed, 38 insertions, 27 deletions
diff --git a/lib/if.c b/lib/if.c
index 0fd65da03..16b651244 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -1379,13 +1379,13 @@ const struct frr_yang_module_info frr_interface_info = {
{
.xpath = "/frr-interface:lib/interface",
.cbs.create = lib_interface_create,
- .cbs.delete = lib_interface_delete,
+ .cbs.destroy = lib_interface_delete,
.cbs.cli_show = cli_show_interface,
},
{
.xpath = "/frr-interface:lib/interface/description",
.cbs.modify = lib_interface_description_modify,
- .cbs.delete = lib_interface_description_delete,
+ .cbs.destroy = lib_interface_description_delete,
.cbs.cli_show = cli_show_interface_desc,
},
{
diff --git a/lib/log.h b/lib/log.h
index 8fb98a02a..816daea30 100644
--- a/lib/log.h
+++ b/lib/log.h
@@ -93,11 +93,11 @@ extern void zlog_debug(const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
/* For logs which have error codes associated with them */
#define flog_err(ferr_id, format, ...) \
- zlog_err("[EC %"PRIu32"] " format, ferr_id, ##__VA_ARGS__)
+ zlog_err("[EC %" PRIu32 "] " format, ferr_id, ##__VA_ARGS__)
#define flog_err_sys(ferr_id, format, ...) \
flog_err(ferr_id, format, ##__VA_ARGS__)
#define flog_warn(ferr_id, format, ...) \
- zlog_warn("[EC %"PRIu32"] " format, ferr_id, ##__VA_ARGS__)
+ zlog_warn("[EC %" PRIu32 "] " format, ferr_id, ##__VA_ARGS__)
extern void zlog_thread_info(int log_level);
diff --git a/lib/nexthop_group.h b/lib/nexthop_group.h
index 473ecb34f..b31ec7f06 100644
--- a/lib/nexthop_group.h
+++ b/lib/nexthop_group.h
@@ -92,12 +92,12 @@ DECLARE_QOBJ_TYPE(nexthop_group_cmd)
* code
*/
void nexthop_group_init(
- void (*new)(const char *name),
+ void (*create)(const char *name),
void (*add_nexthop)(const struct nexthop_group_cmd *nhgc,
const struct nexthop *nhop),
void (*del_nexthop)(const struct nexthop_group_cmd *nhgc,
const struct nexthop *nhop),
- void (*delete)(const char *name));
+ void (*destroy)(const char *name));
void nexthop_group_enable_vrf(struct vrf *vrf);
void nexthop_group_disable_vrf(struct vrf *vrf);
diff --git a/lib/northbound.c b/lib/northbound.c
index 6fe612d72..951c2d5cb 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -185,7 +185,7 @@ static unsigned int nb_node_validate_cbs(const struct nb_node *nb_node)
error += nb_node_validate_cb(nb_node, NB_OP_MODIFY,
!!nb_node->cbs.modify, false);
error += nb_node_validate_cb(nb_node, NB_OP_DELETE,
- !!nb_node->cbs.delete, false);
+ !!nb_node->cbs.destroy, false);
error += nb_node_validate_cb(nb_node, NB_OP_MOVE, !!nb_node->cbs.move,
false);
error += nb_node_validate_cb(nb_node, NB_OP_APPLY_FINISH,
@@ -742,7 +742,7 @@ static int nb_configuration_callback(const enum nb_event event,
ret = (*nb_node->cbs.modify)(event, dnode, resource);
break;
case NB_OP_DELETE:
- ret = (*nb_node->cbs.delete)(event, dnode);
+ ret = (*nb_node->cbs.destroy)(event, dnode);
break;
case NB_OP_MOVE:
ret = (*nb_node->cbs.move)(event, dnode);
diff --git a/lib/northbound.h b/lib/northbound.h
index 9d35a4e64..557c4fb7c 100644
--- a/lib/northbound.h
+++ b/lib/northbound.h
@@ -168,7 +168,7 @@ struct nb_callbacks {
* - NB_ERR_INCONSISTENCY when an inconsistency was detected.
* - NB_ERR for other errors.
*/
- int (*delete)(enum nb_event event, const struct lyd_node *dnode);
+ int (*destroy)(enum nb_event event, const struct lyd_node *dnode);
/*
* Configuration callback.
diff --git a/lib/openbsd-tree.h b/lib/openbsd-tree.h
index 1383ef6de..b3efe4cbd 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( \
diff --git a/lib/srcdest_table.h b/lib/srcdest_table.h
index 54acb51b0..6f9457826 100644
--- a/lib/srcdest_table.h
+++ b/lib/srcdest_table.h
@@ -84,7 +84,8 @@ static inline int rnode_is_srcnode(struct route_node *rn)
static inline struct route_table *srcdest_rnode_table(struct route_node *rn)
{
if (rnode_is_srcnode(rn)) {
- struct route_node *dst_rn = route_table_get_info(rn->table);
+ struct route_node *dst_rn =
+ (struct route_node *)route_table_get_info(rn->table);
return dst_rn->table;
} else {
return rn->table;
diff --git a/lib/table.h b/lib/table.h
index 541d74d77..a251d2206 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -275,12 +275,15 @@ static inline struct route_node *route_table_iter_next(route_table_iter_t *iter)
break;
case RT_ITER_STATE_PAUSED:
+ {
+ union prefixconstptr cp = {.p = &iter->pause_prefix};
/*
* Start with the node following pause_prefix.
*/
- node = route_table_get_next(iter->table, &iter->pause_prefix);
- break;
+ node = route_table_get_next(iter->table, cp);
+ }
+ break;
case RT_ITER_STATE_DONE:
return NULL;
diff --git a/lib/vrf.c b/lib/vrf.c
index f9f14822c..df93bc33b 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -471,7 +471,7 @@ static const struct cmd_variable_handler vrf_var_handlers[] = {
/* Initialize VRF module. */
void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
- int (*disable)(struct vrf *), int (*delete)(struct vrf *),
+ int (*disable)(struct vrf *), int (*destroy)(struct vrf *),
int ((*update)(struct vrf *)))
{
struct vrf *default_vrf;
@@ -485,7 +485,7 @@ void vrf_init(int (*create)(struct vrf *), int (*enable)(struct vrf *),
vrf_master.vrf_new_hook = create;
vrf_master.vrf_enable_hook = enable;
vrf_master.vrf_disable_hook = disable;
- vrf_master.vrf_delete_hook = delete;
+ vrf_master.vrf_delete_hook = destroy;
vrf_master.vrf_update_name_hook = update;
/* The default VRF always exists. */
diff --git a/lib/vrf.h b/lib/vrf.h
index e80796f48..20ca85d09 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -200,7 +200,7 @@ extern int vrf_bitmap_check(vrf_bitmap_t, vrf_id_t);
* the system ( 2 and 3 ) above.
*/
extern void vrf_init(int (*create)(struct vrf *vrf), int (*enable)(struct vrf *vrf),
- int (*disable)(struct vrf *vrf), int (*delete)(struct vrf *vrf),
+ int (*disable)(struct vrf *vrf), int (*destroy)(struct vrf *vrf),
int (*update)(struct vrf *vrf));
/*