]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd, lib: Use bool instead of uint8_t for community/prefix-list "any" 6239/head
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 16 Apr 2020 08:15:35 +0000 (11:15 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 16 Apr 2020 12:27:51 +0000 (15:27 +0300)
That's only 0/1, useful to use just a bool for that.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bgpd/bgp_clist.c
bgpd/bgp_clist.h
lib/plist.c
lib/plist_int.h

index 1361ef99bea07fc294655afdc69e7e2260774610..28b22997ed9974ff8953d3693b55cdcc86207301 100644 (file)
@@ -972,7 +972,7 @@ int community_list_set(struct community_list_handler *ch, const char *name,
        entry = community_entry_new();
        entry->direct = direct;
        entry->style = style;
-       entry->any = (str ? 0 : 1);
+       entry->any = (str ? false : true);
        entry->u.com = com;
        entry->reg = regex;
        entry->seq = seqnum;
@@ -1169,7 +1169,7 @@ int lcommunity_list_set(struct community_list_handler *ch, const char *name,
        entry = community_entry_new();
        entry->direct = direct;
        entry->style = style;
-       entry->any = (str ? 0 : 1);
+       entry->any = (str ? false : true);
        entry->u.lcom = lcom;
        entry->reg = regex;
        entry->seq = seqnum;
@@ -1290,7 +1290,7 @@ int extcommunity_list_set(struct community_list_handler *ch, const char *name,
        entry = community_entry_new();
        entry->direct = direct;
        entry->style = style;
-       entry->any = 0;
+       entry->any = false;
        if (ecom)
                entry->config = ecommunity_ecom2str(
                        ecom, ECOMMUNITY_FORMAT_COMMUNITY_LIST, 0);
index 4cb5d7c593c5cf95e8d944bb177608b50452e393..f7d46525a0d2ebc26380d739d7e0846629095e9b 100644 (file)
@@ -81,7 +81,7 @@ struct community_entry {
        uint8_t style;
 
        /* Any match.  */
-       uint8_t any;
+       bool any;
 
        /* Sequence number. */
        int64_t seq;
index b7a020c6f7af01db9415c8492aa7ac64a2728a38..c423c3005e3181df964040c550395a5d814d1caf 100644 (file)
@@ -348,14 +348,14 @@ static void prefix_list_delete(struct prefix_list *plist)
 
 static struct prefix_list_entry *
 prefix_list_entry_make(struct prefix *prefix, enum prefix_list_type type,
-                      int64_t seq, int le, int ge, int any)
+                      int64_t seq, int le, int ge, bool any)
 {
        struct prefix_list_entry *pentry;
 
        pentry = prefix_list_entry_new();
 
        if (any)
-               pentry->any = 1;
+               pentry->any = true;
 
        prefix_copy(&pentry->prefix, prefix);
        pentry->type = type;
@@ -851,7 +851,7 @@ static int vty_prefix_list_install(struct vty *vty, afi_t afi, const char *name,
        struct prefix_list_entry *pentry;
        struct prefix_list_entry *dup;
        struct prefix p, p_tmp;
-       int any = 0;
+       bool any = false;
        int64_t seqnum = -1;
        int lenum = 0;
        int genum = 0;
@@ -889,7 +889,7 @@ static int vty_prefix_list_install(struct vty *vty, afi_t afi, const char *name,
                                              (struct prefix_ipv4 *)&p);
                        genum = 0;
                        lenum = IPV4_MAX_BITLEN;
-                       any = 1;
+                       any = true;
                } else
                        ret = str2prefix_ipv4(prefix, (struct prefix_ipv4 *)&p);
 
@@ -908,7 +908,7 @@ static int vty_prefix_list_install(struct vty *vty, afi_t afi, const char *name,
                        ret = str2prefix_ipv6("::/0", (struct prefix_ipv6 *)&p);
                        genum = 0;
                        lenum = IPV6_MAX_BITLEN;
-                       any = 1;
+                       any = true;
                } else
                        ret = str2prefix_ipv6(prefix, (struct prefix_ipv6 *)&p);
 
@@ -1898,7 +1898,7 @@ int prefix_bgp_orf_set(char *name, afi_t afi, struct orf_prefix *orfp,
        if (set) {
                pentry = prefix_list_entry_make(
                        &orfp->p, (permit ? PREFIX_PERMIT : PREFIX_DENY),
-                       orfp->seq, orfp->le, orfp->ge, 0);
+                       orfp->seq, orfp->le, orfp->ge, false);
 
                if (prefix_entry_dup_check(plist, pentry)) {
                        prefix_list_entry_free(pentry);
index 443b0c614dfb3a76f0ae63c8ee160bf47b68d6c8..ec8bbe1315905e57ee24a26efc566ab47193087b 100644 (file)
@@ -59,7 +59,7 @@ struct prefix_list_entry {
 
        enum prefix_list_type type;
 
-       int any;
+       bool any;
        struct prefix prefix;
 
        unsigned long refcnt;