summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-03-06 15:54:44 +0100
committerGitHub <noreply@github.com>2019-03-06 15:54:44 +0100
commitd3b05897edff14ceb71c2f5603a9fcdb1ae10c83 (patch)
tree274b088939d9686c289d5de95d70cdb39a01e4b4 /isisd
parentRevert "nhrpd: strncpy -> strlcpy" (diff)
parenttools: add coccinelle spatches (diff)
downloadfrr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.tar.xz
frr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.zip
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
Diffstat (limited to 'isisd')
-rw-r--r--isisd/dict.c8
-rw-r--r--isisd/isis_adjacency.c9
-rw-r--r--isisd/isis_dlpi.c2
-rw-r--r--isisd/isis_main.c2
-rw-r--r--isisd/isis_pdu.c16
-rw-r--r--isisd/isis_redist.c3
-rw-r--r--isisd/isis_tlvs.c5
7 files changed, 18 insertions, 27 deletions
diff --git a/isisd/dict.c b/isisd/dict.c
index 5d3e61e6d..d91f05d25 100644
--- a/isisd/dict.c
+++ b/isisd/dict.c
@@ -1095,10 +1095,10 @@ void dict_load_end(dict_load_t *load)
baselevel = level = 1;
complete = tree[0];
- if (complete != 0) {
+ if (complete != NULL) {
tree[0] = 0;
complete->right = dictnil;
- while (tree[level] != 0) {
+ while (tree[level] != NULL) {
tree[level]->right = complete;
complete->parent = tree[level];
complete = tree[level];
@@ -1114,7 +1114,7 @@ void dict_load_end(dict_load_t *load)
complete = curr;
assert(level == baselevel);
- while (tree[level] != 0) {
+ while (tree[level] != NULL) {
tree[level]->right = complete;
complete->parent = tree[level];
complete = tree[level];
@@ -1134,7 +1134,7 @@ void dict_load_end(dict_load_t *load)
complete = dictnil;
for (i = 0; i < DICT_DEPTH_MAX; i++) {
- if (tree[i] != 0) {
+ if (tree[i] != NULL) {
tree[i]->right = complete;
complete->parent = tree[i];
complete = tree[i];
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index e1cdfc30e..62814329e 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -140,12 +140,9 @@ void isis_delete_adj(void *arg)
/* remove from SPF trees */
spftree_area_adj_del(adj->circuit->area, adj);
- if (adj->area_addresses)
- XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->area_addresses);
- if (adj->ipv4_addresses)
- XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->ipv4_addresses);
- if (adj->ipv6_addresses)
- XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->ipv6_addresses);
+ XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->area_addresses);
+ XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->ipv4_addresses);
+ XFREE(MTYPE_ISIS_ADJACENCY_INFO, adj->ipv6_addresses);
adj_mt_finish(adj);
diff --git a/isisd/isis_dlpi.c b/isisd/isis_dlpi.c
index 54a19ad23..148b43866 100644
--- a/isisd/isis_dlpi.c
+++ b/isisd/isis_dlpi.c
@@ -444,7 +444,7 @@ static int open_dlpi_dev(struct isis_circuit *circuit)
struct strioctl sioc;
pfil.Pf_Priority = 0;
- pfil.Pf_FilterLen = sizeof(pf_filter) / sizeof(unsigned short);
+ pfil.Pf_FilterLen = array_size(pf_filter);
memcpy(pfil.Pf_Filter, pf_filter, sizeof(pf_filter));
/* pfmod does not support transparent ioctls */
sioc.ic_cmd = PFIOCSETF;
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index 9126e40d4..e74a9baad 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -80,7 +80,7 @@ struct zebra_privs_t isisd_privs = {
.vty_group = VTY_GROUP,
#endif
.caps_p = _caps_p,
- .cap_num_p = sizeof(_caps_p) / sizeof(*_caps_p),
+ .cap_num_p = array_size(_caps_p),
.cap_num_i = 0};
/* isisd options */
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 330da9b21..107de47f3 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -2146,11 +2146,11 @@ int send_csnp(struct isis_circuit *circuit, int level)
* stop lsp_id in this current CSNP.
*/
memcpy(start, stop, ISIS_SYS_ID_LEN + 2);
- loop = 0;
+ loop = false;
for (int i = ISIS_SYS_ID_LEN + 1; i >= 0; --i) {
if (start[i] < (uint8_t)0xff) {
start[i] += 1;
- loop = 1;
+ loop = true;
break;
}
}
@@ -2164,7 +2164,6 @@ int send_csnp(struct isis_circuit *circuit, int level)
int send_l1_csnp(struct thread *thread)
{
struct isis_circuit *circuit;
- int retval = ISIS_OK;
circuit = THREAD_ARG(thread);
assert(circuit);
@@ -2181,13 +2180,12 @@ int send_l1_csnp(struct thread *thread)
isis_jitter(circuit->csnp_interval[0], CSNP_JITTER),
&circuit->t_send_csnp[0]);
- return retval;
+ return ISIS_OK;
}
int send_l2_csnp(struct thread *thread)
{
struct isis_circuit *circuit;
- int retval = ISIS_OK;
circuit = THREAD_ARG(thread);
assert(circuit);
@@ -2204,7 +2202,7 @@ int send_l2_csnp(struct thread *thread)
isis_jitter(circuit->csnp_interval[1], CSNP_JITTER),
&circuit->t_send_csnp[1]);
- return retval;
+ return ISIS_OK;
}
/*
@@ -2329,7 +2327,6 @@ int send_l1_psnp(struct thread *thread)
{
struct isis_circuit *circuit;
- int retval = ISIS_OK;
circuit = THREAD_ARG(thread);
assert(circuit);
@@ -2342,7 +2339,7 @@ int send_l1_psnp(struct thread *thread)
isis_jitter(circuit->psnp_interval[0], PSNP_JITTER),
&circuit->t_send_psnp[0]);
- return retval;
+ return ISIS_OK;
}
/*
@@ -2352,7 +2349,6 @@ int send_l1_psnp(struct thread *thread)
int send_l2_psnp(struct thread *thread)
{
struct isis_circuit *circuit;
- int retval = ISIS_OK;
circuit = THREAD_ARG(thread);
assert(circuit);
@@ -2366,7 +2362,7 @@ int send_l2_psnp(struct thread *thread)
isis_jitter(circuit->psnp_interval[1], PSNP_JITTER),
&circuit->t_send_psnp[1]);
- return retval;
+ return ISIS_OK;
}
/*
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c
index 20f3e62a7..3a864fb35 100644
--- a/isisd/isis_redist.c
+++ b/isisd/isis_redist.c
@@ -504,8 +504,7 @@ void isis_redist_area_finish(struct isis_area *area)
redist = &area->redist_settings[protocol][type]
[level];
redist->redist = 0;
- if (redist->map_name)
- XFREE(MTYPE_ISIS, redist->map_name);
+ XFREE(MTYPE_ISIS, redist->map_name);
}
route_table_finish(area->ext_reach[protocol][level]);
}
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index 5a6c7bc30..fbb1e5714 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -1913,7 +1913,7 @@ static void format_item_auth(uint16_t mtid, struct isis_item *i,
default:
sbuf_push(buf, indent, " Unknown (%" PRIu8 ")\n", auth->type);
break;
- };
+ }
}
static void free_item_auth(struct isis_item *i)
@@ -3202,8 +3202,7 @@ void isis_tlvs_set_protocols_supported(struct isis_tlvs *tlvs,
struct nlpids *nlpids)
{
tlvs->protocols_supported.count = nlpids->count;
- if (tlvs->protocols_supported.protocols)
- XFREE(MTYPE_ISIS_TLV, tlvs->protocols_supported.protocols);
+ XFREE(MTYPE_ISIS_TLV, tlvs->protocols_supported.protocols);
if (nlpids->count) {
tlvs->protocols_supported.protocols =
XCALLOC(MTYPE_ISIS_TLV, nlpids->count);