From c805d879c9af5d907d45a033dc93987e8c9895bf Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 9 May 2022 07:03:21 -0400
Subject: [PATCH] More needless stream allocations

---
 indra/llxml/llcontrol.cpp           | 5 ++++-
 indra/newview/lllocationhistory.cpp | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 40ce1f73a0e..7b9707159a4 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -50,6 +50,8 @@
 #include "lltimer.h"
 #include "lldir.h"
 
+#include <boost/iostreams/stream.hpp>
+
 #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
 #define CONTROL_ERRS LL_ERRS("ControlErrors")
 #else
@@ -203,7 +205,8 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value)
 	{
 		LLPointer<LLSDNotationParser> parser = new LLSDNotationParser;
 		LLSD result;
-		std::stringstream value_stream(value.asString());
+		const auto& llsd_str = value.asStringRef();
+		boost::iostreams::stream<boost::iostreams::array_source> value_stream(llsd_str.data(), llsd_str.size());
 		if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE)
 		{
 			storable_value = result;
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp
index 162d6e003e9..4cc17f6d0d5 100644
--- a/indra/newview/lllocationhistory.cpp
+++ b/indra/newview/lllocationhistory.cpp
@@ -34,6 +34,9 @@
 #include "llsd.h"
 #include "llsdserialize.h"
 
+#include <boost/iostreams/device/array.hpp>
+#include <boost/iostreams/stream.hpp>
+
 LLLocationHistory::LLLocationHistory() :
 	mFilename("typed_locations.txt")
 {
@@ -163,7 +166,7 @@ void LLLocationHistory::load()
 	LLPointer<LLSDParser> parser = new LLSDNotationParser();
 	while (std::getline(file, line)) {
 		LLSD s_item;
-		std::istringstream iss(line);
+		boost::iostreams::stream<boost::iostreams::array_source> iss(line.data(), line.size());
 		if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
 		{
 			LL_INFOS()<< "Parsing saved teleport history failed" << LL_ENDL;
-- 
GitLab