]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Use bool instead of int, cleanup
authorIgor Putovny <igor.putovny@nic.cz>
Thu, 10 Apr 2025 14:15:09 +0000 (16:15 +0200)
committerIgor Putovny <igor.putovny@nic.cz>
Tue, 29 Apr 2025 13:01:15 +0000 (15:01 +0200)
proto/aggregator/aggregator.c
proto/aggregator/aggregator.h
proto/aggregator/config.Y
proto/aggregator/trie.c

index 1d1fdd48f1627fcd31467f4a6cde6026a0446e4f..6ec3236db9d8dca070d190333cb54d8ceedafef3 100644 (file)
@@ -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
index d316f979df46e3e6fd52cb1242505e67db9f7bb5..9ff844f1a0631cf9eb81071bf4d805f0b9a5dcd0 100644 (file)
@@ -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;
index bd56a81bdd6eec9d4fa748ea6d4e82bbd16d28ca..f90fe994ce7f32bffd41b2694224f5374582a9c6 100644 (file)
@@ -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 ';' ;
index 7bf793b0b4954935530792fccb1a9e9edaa1a5bc..6d3fe3f8fd58bf335db348e80a8b5e7e5c15254d 100644 (file)
 #include "filter/filter.h"
 #include "proto/aggregator/aggregator.h"
 
-#include <stdbool.h>
-
 static const char *px_origin_str[] = {
   [FILLER]     = "filler",
   [ORIGINAL]   = "original",