sfx2/source/view/classificationhelper.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit afdc48751314300231b783ad26001fb32241dff5
Author:     Arnaud VERSINI <[email protected]>
AuthorDate: Fri Sep 5 15:52:47 2025 +0200
Commit:     Arnaud Versini <[email protected]>
CommitDate: Wed Sep 10 21:17:10 2025 +0200

    sfx2 : use frozen::unordered_maps to avoid allocations
    
    Change-Id: I1259bc5f33f1c0d91493f24b5993237530cd8adb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190617
    Tested-by: Jenkins
    Reviewed-by: Arnaud Versini <[email protected]>

diff --git a/sfx2/source/view/classificationhelper.cxx 
b/sfx2/source/view/classificationhelper.cxx
index b74f2486d2a9..d35df6733a05 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -13,6 +13,10 @@
 #include <algorithm>
 #include <iterator>
 
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
+
 #include <com/sun/star/beans/XPropertyContainer.hpp>
 #include <com/sun/star/beans/Property.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -761,12 +765,12 @@ sal_Int32 SfxClassificationHelper::GetImpactLevel()
     }
     else if (aScale == "FIPS-199")
     {
-        static std::map<OUString, sal_Int32> const aValues
+        static auto constexpr aValues = 
frozen::make_unordered_map<std::u16string_view, sal_Int32>(
         {
-            { "Low", 0 },
-            { "Moderate", 1 },
-            { "High", 2 }
-        };
+            { u"Low", 0 },
+            { u"Moderate", 1 },
+            { u"High", 2 }
+        });
         auto itValues = aValues.find(aLevel);
         if (itValues == aValues.end())
             return nRet;

Reply via email to