From: Igor Putovny Date: Thu, 10 Apr 2025 14:15:09 +0000 (+0200) Subject: Use bool instead of int, cleanup X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4da41ca53b02cd9057848fc7d35d464cbec57303;p=thirdparty%2Fbird.git Use bool instead of int, cleanup --- diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index 1d1fdd48f..6ec3236db 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -125,8 +125,8 @@ aggregator_aggregate_on_feed_end(struct channel *C) ASSERT_DIE(p->aggr_mode == PREFIX_AGGR); ASSERT_DIE(p->root != NULL); - p->initial_feed = 0; aggregator_aggregate(p); + p->initial_feed = false; } /* @@ -886,11 +886,11 @@ aggregator_start(struct proto *P) .data = p, }; - p->initial_feed = 1; - - hmap_init(&p->bucket_id_map, p->p.pool, 1024); + hmap_init(&p->bucket_id_map, P->pool, 1024); hmap_set(&p->bucket_id_map, 0); /* 0 is default value, do not use it as ID */ + p->initial_feed = true; + if (p->aggr_mode == PREFIX_AGGR) { ASSERT_DIE(p->trie_slab == NULL); @@ -901,7 +901,7 @@ aggregator_start(struct proto *P) ASSERT_DIE(p->bucket_list_count == 0); p->bucket_list_size = BUCKET_LIST_INIT_SIZE; - p->bucket_list = mb_allocz(p->p.pool, sizeof(p->bucket_list[0]) * p->bucket_list_size); + p->bucket_list = mb_allocz(P->pool, sizeof(p->bucket_list[0]) * p->bucket_list_size); p->rte_withdrawal_pool = lp_new(P->pool); p->rte_withdrawal_count = 0; @@ -943,7 +943,7 @@ aggregator_cleanup(struct proto *P) p->bucket_id_map = (struct hmap) { 0 }; - p->initial_feed = 1; + p->initial_feed = true; } static int diff --git a/proto/aggregator/aggregator.h b/proto/aggregator/aggregator.h index d316f979d..9ff844f1a 100644 --- a/proto/aggregator/aggregator.h +++ b/proto/aggregator/aggregator.h @@ -72,29 +72,29 @@ struct aggregator_proto { HASH(struct aggregator_route) routes; struct linpool *route_pool; + /* Bucket IDs */ + struct hmap bucket_id_map; + /* Aggregator rule */ + struct aggr_item *aggr_on; u32 aggr_on_count; u32 aggr_on_da_count; - struct aggr_item *aggr_on; /* Merge filter */ const struct f_line *merge_by; event reload_buckets; /* Aggregation trie */ - u32 addr_type; struct trie_node *root; struct slab *trie_slab; - int initial_feed; - int logging; + u32 addr_type; + bool initial_feed; + bool logging; /* Array of bucket pointers */ struct aggregator_bucket **bucket_list; - size_t bucket_list_size; - size_t bucket_list_count; - - /* Bucket IDs */ - struct hmap bucket_id_map; + uint bucket_list_size; + int bucket_list_count; /* Route withdrawal */ struct rte_withdrawal_item *rte_withdrawal_stack; diff --git a/proto/aggregator/config.Y b/proto/aggregator/config.Y index bd56a81bd..f90fe994c 100644 --- a/proto/aggregator/config.Y +++ b/proto/aggregator/config.Y @@ -53,7 +53,7 @@ aggregator_proto_start: proto_start AGGREGATOR AGGREGATOR_CFG->aggr_mode = PREFIX_AGGR; AGGREGATOR_CFG->src->ra_mode = RA_OPTIMAL; AGGREGATOR_CFG->dst->ra_mode = RA_ANY; - AGGREGATOR_CFG->logging = 0; + AGGREGATOR_CFG->logging = false; }; aggregator_proto_item: @@ -100,7 +100,7 @@ aggregator_proto_item: $4->args++; AGGREGATOR_CFG->merge_by = $4; } - | LOG ALL { AGGREGATOR_CFG->logging = 1; } + | LOG ALL { AGGREGATOR_CFG->logging = true; } ; aggregator_proto_opts: /* empty */ | aggregator_proto_opts aggregator_proto_item ';' ; diff --git a/proto/aggregator/trie.c b/proto/aggregator/trie.c index 7bf793b0b..6d3fe3f8f 100644 --- a/proto/aggregator/trie.c +++ b/proto/aggregator/trie.c @@ -142,8 +142,6 @@ #include "filter/filter.h" #include "proto/aggregator/aggregator.h" -#include - static const char *px_origin_str[] = { [FILLER] = "filler", [ORIGINAL] = "original",