summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-02-25 19:55:37 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-02-26 00:00:16 +0100
commitb08047f82d887d1ea639bbfe97147b46572099d5 (patch)
tree0651f297cdb62015696c6f75e8c4f8ae34f2b7f2
parent*: use proper bool initializers & fix comparisons (diff)
downloadfrr-b08047f82d887d1ea639bbfe97147b46572099d5.tar.xz
frr-b08047f82d887d1ea639bbfe97147b46572099d5.zip
*: return bool from boolean functions
Not 1 or 0. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_lcommunity.c4
-rw-r--r--bgpd/bgp_updgrp.c2
-rw-r--r--lib/frrstr.c4
-rw-r--r--tests/lib/test_srcdest_table.c2
-rw-r--r--zebra/zebra_pbr.c2
5 files changed, 7 insertions, 7 deletions
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c
index 06281e16c..9934ab4c1 100644
--- a/bgpd/bgp_lcommunity.c
+++ b/bgpd/bgp_lcommunity.c
@@ -319,10 +319,10 @@ bool lcommunity_cmp(const void *arg1, const void *arg2)
const struct lcommunity *lcom2 = arg2;
if (lcom1 == NULL && lcom2 == NULL)
- return 1;
+ return true;
if (lcom1 == NULL || lcom2 == NULL)
- return 0;
+ return false;
return (lcom1->size == lcom2->size
&& memcmp(lcom1->val, lcom2->val, lcom_length(lcom1)) == 0);
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index b74dc33ea..472800de1 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -440,7 +440,7 @@ static bool updgrp_hash_cmp(const void *p1, const void *p2)
return false;
if (pe1->addpath_type[afi][safi] != pe2->addpath_type[afi][safi])
- return 0;
+ return false;
if ((pe1->cap & PEER_UPDGRP_CAP_FLAGS)
!= (pe2->cap & PEER_UPDGRP_CAP_FLAGS))
diff --git a/lib/frrstr.c b/lib/frrstr.c
index 85d968182..fd337073f 100644
--- a/lib/frrstr.c
+++ b/lib/frrstr.c
@@ -155,13 +155,13 @@ void frrstr_strvec_free(vector v)
bool begins_with(const char *str, const char *prefix)
{
if (!str || !prefix)
- return 0;
+ return false;
size_t lenstr = strlen(str);
size_t lenprefix = strlen(prefix);
if (lenprefix > lenstr)
- return 0;
+ return false;
return strncmp(str, prefix, lenprefix) == 0;
}
diff --git a/tests/lib/test_srcdest_table.c b/tests/lib/test_srcdest_table.c
index 5c0e17177..19a40b218 100644
--- a/tests/lib/test_srcdest_table.c
+++ b/tests/lib/test_srcdest_table.c
@@ -105,7 +105,7 @@ static unsigned int log_key(void *data)
static bool log_cmp(const void *a, const void *b)
{
if (a == NULL || b == NULL)
- return 0;
+ return false;
return !memcmp(a, b, 2 * sizeof(struct prefix));
}
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 348bdeb9f..73db567ea 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -388,7 +388,7 @@ bool zebra_pbr_iptable_hash_equal(const void *arg1, const void *arg2)
r2 = (const struct zebra_pbr_iptable *)arg2;
if (r1->vrf_id != r2->vrf_id)
- return 0;
+ return false;
if (r1->type != r2->type)
return false;
if (r1->unique != r2->unique)