From 0647597e8e2b0318baffa376b14b0fafc2348db6 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 24 May 2024 09:34:56 +0200 Subject: [PATCH] Prevent unnecessary string copies --- indra/llcommon/llstring.h | 1 + indra/newview/fscommon.cpp | 8 ++++---- indra/newview/fscommon.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index e87f8feddf..eb706aea21 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -456,6 +456,7 @@ template std::string LLStringUtilBase::sLocale; typedef LLStringUtilBase LLStringUtil; typedef LLStringUtilBase LLWStringUtil; typedef std::basic_string LLWString; +typedef std::basic_string_view LLWStringView; //@ Use this where we want to disallow input in the form of "foo" // This is used to catch places where english text is embedded in the code diff --git a/indra/newview/fscommon.cpp b/indra/newview/fscommon.cpp index 4f0d4a2487..cd81ad04e3 100644 --- a/indra/newview/fscommon.cpp +++ b/indra/newview/fscommon.cpp @@ -505,7 +505,7 @@ bool FSCommon::isFilterEditorKeyCombo(KEY key, MASK mask) LLUUID FSCommon::getGroupForRezzing() { - LLUUID group_id = gAgent.getGroupID(); + LLUUID group_id{ gAgent.getGroupID() }; LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel && gSavedSettings.getBOOL("RezUnderLandGroup")) @@ -523,12 +523,12 @@ LLUUID FSCommon::getGroupForRezzing() return group_id; } -void FSCommon::updateUsedEmojis(LLWString text) +void FSCommon::updateUsedEmojis(LLWStringView text) { LLEmojiDictionary* dictionary = LLEmojiDictionary::getInstance(); - bool emojiSent = false; - for (llwchar& c : text) + bool emojiSent{ false }; + for (const llwchar& c : text) { if (dictionary->isEmoji(c)) { diff --git a/indra/newview/fscommon.h b/indra/newview/fscommon.h index 2cd77627a9..2e7946b0e5 100644 --- a/indra/newview/fscommon.h +++ b/indra/newview/fscommon.h @@ -94,7 +94,7 @@ namespace FSCommon LLUUID getGroupForRezzing(); - void updateUsedEmojis(LLWString text); + void updateUsedEmojis(LLWStringView text); }; #endif // FS_COMMON_H