commit e1a5d57: [Minor] Another try to reduce compile time using broken toolset

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Jun 23 18:56:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-06-23 19:53:37 +0100
URL: https://github.com/rspamd/rspamd/commit/e1a5d57c6e397f2125ce1aaad7292e11288b7eef (HEAD -> master)

[Minor] Another try to reduce compile time using broken toolset

---
 src/libserver/html/html_entities.cxx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/libserver/html/html_entities.cxx b/src/libserver/html/html_entities.cxx
index d124ace1e..4ad68a0f8 100644
--- a/src/libserver/html/html_entities.cxx
+++ b/src/libserver/html/html_entities.cxx
@@ -40,7 +40,7 @@ struct html_entity_def {
 #define ENTITY_DEF(name, code, replacement) html_entity_def{(name), (replacement), (code), false}
 #define ENTITY_DEF_HEUR(name, code, replacement) html_entity_def{(name), (replacement), (code), true}
 
-static const auto html_entities_array = std::vector<html_entity_def>{
+static const html_entity_def html_entities_array[] = {
 		ENTITY_DEF_HEUR("szlig", 223, "\xc3\x9f"),
 		ENTITY_DEF("prime", 8242, "\xe2\x80\xb2"),
 		ENTITY_DEF("lnsim", 8934, "\xe2\x8b\xa6"),
@@ -2173,8 +2173,9 @@ class html_entities_storage {
 	robin_hood::unordered_flat_map<unsigned, html_entity_def> entity_by_id;
 public:
 	html_entities_storage() {
-		entity_by_name.reserve(html_entities_array.size());
-		entity_by_id.reserve(html_entities_array.size());
+		auto nelts = G_N_ELEMENTS(html_entities_array);
+		entity_by_name.reserve(nelts);
+		entity_by_id.reserve(nelts);
 
 		for (const auto &e : html_entities_array) {
 			entity_by_name[e.name] = e;


More information about the Commits mailing list