From 6c48f5ac63a52e2779b60836a07be0fa368c0d3f Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Wed, 6 Sep 2023 15:09:50 +0200
Subject: [PATCH] tag/Pool: use std::array

---
 src/tag/Pool.cxx | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/tag/Pool.cxx b/src/tag/Pool.cxx
index 5136e5598..9314e6c08 100644
--- a/src/tag/Pool.cxx
+++ b/src/tag/Pool.cxx
@@ -6,6 +6,7 @@
 #include "util/Cast.hxx"
 #include "util/VarSize.hxx"
 
+#include <array>
 #include <cassert>
 #include <cstdint>
 #include <limits>
@@ -15,8 +16,6 @@
 
 Mutex tag_pool_lock;
 
-static constexpr size_t NUM_SLOTS = 16127;
-
 struct TagPoolSlot {
 	TagPoolSlot *next;
 	uint8_t ref = 1;
@@ -46,7 +45,7 @@ TagPoolSlot::Create(TagPoolSlot *_next, TagType type,
 				       value);
 }
 
-static TagPoolSlot *slots[NUM_SLOTS];
+static std::array<TagPoolSlot *, 16127> slots;
 
 static inline unsigned
 calc_hash(TagType type, std::string_view p) noexcept
@@ -81,13 +80,13 @@ tag_item_to_slot(TagItem *item) noexcept
 static inline TagPoolSlot **
 tag_value_slot_p(TagType type, std::string_view value) noexcept
 {
-	return &slots[calc_hash(type, value) % NUM_SLOTS];
+	return &slots[calc_hash(type, value) % slots.size()];
 }
 
 static inline TagPoolSlot **
 tag_value_slot_p(TagType type, const char *value) noexcept
 {
-	return &slots[calc_hash(type, value) % NUM_SLOTS];
+	return &slots[calc_hash(type, value) % slots.size()];
 }
 
 TagItem *