From: Igor Putovny Date: Thu, 10 Apr 2025 17:44:06 +0000 (+0200) Subject: Remove get_new_bucket_id() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe1c350f4eea1c43bcbd32072d1218c5449c0b34;p=thirdparty%2Fbird.git Remove get_new_bucket_id() --- diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index 6ec3236db..c14675b37 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -41,17 +41,6 @@ extern linpool *rte_update_pool; -/* - * Allocate unique ID for bucket - */ -static inline u32 -aggregator_get_new_bucket_id(struct aggregator_proto *p) -{ - u32 id = hmap_first_zero(&p->bucket_id_map); - hmap_set(&p->bucket_id_map, id); - return id; -} - /* * Add @bucket to the list of bucket pointers in @p to position @bucket.id */ @@ -658,7 +647,9 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new memcpy(new_bucket, tmp_bucket, sizeof(*new_bucket) + sizeof(new_bucket->aggr_data[0]) * p->aggr_on_count); HASH_INSERT2(p->buckets, AGGR_BUCK, p->p.pool, new_bucket); - new_bucket->id = aggregator_get_new_bucket_id(p); + new_bucket->id = hmap_first_zero(&p->bucket_id_map); + hmap_set(&p->bucket_id_map, new_bucket->id); + aggregator_add_bucket(p, new_bucket); } @@ -838,7 +829,9 @@ aggregator_trie_init(struct aggregator_proto *p) new_bucket->hash = mem_hash_value(&haux); /* Assign ID to the root node bucket */ - new_bucket->id = aggregator_get_new_bucket_id(p); + new_bucket->id = hmap_first_zero(&p->bucket_id_map); + hmap_set(&p->bucket_id_map, new_bucket->id); + aggregator_add_bucket(p, new_bucket); struct aggregator_route *arte = lp_allocz(p->route_pool, sizeof(*arte));