From 96ff90857a066da70b04684f71237056e12eddfe Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 21 Sep 2021 09:56:14 +0200 Subject: reduce cost of some getProperty calls (tdf#125892) use OUStringLiteral to avoid cost of repeated OUString construction from ascii literal Change-Id: I4f8a4714c093e890adaa5524172bdc91231a561a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122379 Tested-by: Jenkins Reviewed-by: Noel Grandin --- unotools/source/config/lingucfg.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'unotools') diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index bfb7959bc488..3b9232690fc2 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -213,7 +213,7 @@ namespace { struct NamesToHdl { const char *pFullPropName; // full qualified name as used in configuration - const char *pPropName; // property name only (atom) of above + OUString aPropName; // property name only (atom) of above sal_Int32 nHdl; // numeric handle representing the property }; @@ -257,9 +257,9 @@ NamesToHdl const aNamesToHdl[] = {/* 31 */ "GrammarChecking/IsInteractiveCheck", UPN_IS_GRAMMAR_INTERACTIVE, UPH_IS_GRAMMAR_INTERACTIVE}, /* similar to entry 0 (thus no own configuration entry) but with different property name and type */ -{ nullptr, UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE}, +{ nullptr, UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE}, -{ nullptr, nullptr, -1} +{ nullptr, "", -1} }; uno::Sequence< OUString > SvtLinguConfigItem::GetPropertyNames() @@ -304,16 +304,16 @@ bool SvtLinguConfigItem::GetHdlByName( } else { - while (pEntry && pEntry->pPropName != nullptr) + while (pEntry && pEntry->pFullPropName != nullptr) { - if (rPropertyName.equalsAscii( pEntry->pPropName )) + if (rPropertyName == pEntry->aPropName ) { rnHdl = pEntry->nHdl; break; } ++pEntry; } - return pEntry && pEntry->pPropName != nullptr; + return pEntry && pEntry->pFullPropName != nullptr; } } -- cgit