i18npool/source/localedata/LocaleNode.cxx |   16 ++++++++--------
 i18npool/source/localedata/localedata.cxx |   15 +++++++--------
 2 files changed, 15 insertions(+), 16 deletions(-)

New commits:
commit 183e1f9eef4840689e81bbf4d7734df2c7e63c5d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Jun 15 10:31:59 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Jun 15 21:02:59 2023 +0200

    speed up startup time
    
    by avoid conversion of static locale data from sal_Unicode to OUString
    data - we can declare the data as OUStringConstExpr arrays and then
    no conversion is necessary.
    
    Change-Id: Ief35b1e3e08ed44c1b9161485a69ef504e1a1c89
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153123
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/i18npool/source/localedata/LocaleNode.cxx 
b/i18npool/source/localedata/LocaleNode.cxx
index d797c45c53b6..d89a7515c8da 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -296,8 +296,8 @@ void LCInfoNode::generateCode (const OFileWriter &of) const
         aLanguage = languageNode->getChildAt(0)->getValue();
         if (aLanguage.getLength() != 2 && aLanguage.getLength() != 3)
             incErrorStr( "Error: langID '%s' not 2-3 characters\n", aLanguage);
-        of.writeParameter("langID", aLanguage);
-        of.writeParameter("langDefaultName", 
languageNode->getChildAt(1)->getValue());
+        of.writeOUStringLiteralParameter("langID", aLanguage);
+        of.writeOUStringLiteralParameter("langDefaultName", 
languageNode->getChildAt(1)->getValue());
     }
     else
         incError( "No Language node.");
@@ -306,8 +306,8 @@ void LCInfoNode::generateCode (const OFileWriter &of) const
         OUString aCountry( countryNode->getChildAt(0)->getValue());
         if (!(aCountry.isEmpty() || aCountry.getLength() == 2))
             incErrorStr( "Error: countryID '%s' not empty or more than 2 
characters\n", aCountry);
-        of.writeParameter("countryID", aCountry);
-        of.writeParameter("countryDefaultName", 
countryNode->getChildAt(1)->getValue());
+        of.writeOUStringLiteralParameter("countryID", aCountry);
+        of.writeOUStringLiteralParameter("countryDefaultName", 
countryNode->getChildAt(1)->getValue());
     }
     else
         incError( "No Country node.");
@@ -319,18 +319,18 @@ void LCInfoNode::generateCode (const OFileWriter &of) 
const
             incErrorStr( "Error: invalid Variant '%s'\n", aVariant);
         if (!(aVariant.isEmpty() || aLanguage == "qlt"))
             incErrorStrStr( "Error: Variant '%s' given but Language '%s' is 
not 'qlt'\n", aVariant, aLanguage);
-        of.writeParameter("Variant", aVariant);
+        of.writeOUStringLiteralParameter("Variant", aVariant);
     }
     else
-        of.writeParameter("Variant", std::u16string_view());
-    of.writeAsciiString("\nstatic const sal_Unicode* LCInfoArray[] = {\n");
+        of.writeOUStringLiteralParameter("Variant", std::u16string_view());
+    of.writeAsciiString("\nstatic constexpr rtl::OUStringConstExpr 
LCInfoArray[] = {\n");
     of.writeAsciiString("\tlangID,\n");
     of.writeAsciiString("\tlangDefaultName,\n");
     of.writeAsciiString("\tcountryID,\n");
     of.writeAsciiString("\tcountryDefaultName,\n");
     of.writeAsciiString("\tVariant\n");
     of.writeAsciiString("};\n\n");
-    of.writeFunction("getLCInfo_", "SAL_N_ELEMENTS(LCInfoArray)", 
"LCInfoArray");
+    of.writeOUStringFunction("getLCInfo_", "SAL_N_ELEMENTS(LCInfoArray)", 
"LCInfoArray");
 }
 
 
diff --git a/i18npool/source/localedata/localedata.cxx 
b/i18npool/source/localedata/localedata.cxx
index 7316b66fce7f..89ee3d5a281d 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -42,7 +42,6 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star;
 
-typedef sal_Unicode**   (* MyFunc_Type)( sal_Int16&);
 typedef OUString const * (* MyFuncOUString_Type)( sal_Int16&);
 typedef sal_Unicode const *** (* MyFunc_Type2)( sal_Int16&, sal_Int16& );
 typedef sal_Unicode const **** (* MyFunc_Type3)( sal_Int16&, sal_Int16&, 
sal_Int16& );
@@ -1123,16 +1122,16 @@ LocaleDataImpl::getTransliterations( const Locale& 
rLocale )
 LanguageCountryInfo SAL_CALL
 LocaleDataImpl::getLanguageCountryInfo( const Locale& rLocale )
 {
-    MyFunc_Type func = reinterpret_cast<MyFunc_Type>(getFunctionSymbol( 
rLocale, "getLCInfo" ));
+    MyFuncOUString_Type func = 
reinterpret_cast<MyFuncOUString_Type>(getFunctionSymbol( rLocale, "getLCInfo" 
));
 
     if ( func ) {
         sal_Int16 LCInfoCount = 0;
-        sal_Unicode **LCInfoArray = func(LCInfoCount);
-        LanguageCountryInfo info{OUString(LCInfoArray[0]),
-                OUString(LCInfoArray[1]),
-                OUString(LCInfoArray[2]),
-                OUString(LCInfoArray[3]),
-                OUString(LCInfoArray[4])};
+        OUString const *LCInfoArray = func(LCInfoCount);
+        LanguageCountryInfo info{LCInfoArray[0],
+                LCInfoArray[1],
+                LCInfoArray[2],
+                LCInfoArray[3],
+                LCInfoArray[4]};
         return info;
     }
     else {

Reply via email to