Pass std::string_view by value, fix dangling reference in ServerHandler

Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/3aef40d0-f51b-484c-a5d3-43dd37d6187f

Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-10 17:53:48 +00:00
committed by GitHub
parent 40a5871c41
commit 243ca1bdec
6 changed files with 11 additions and 11 deletions

View File

@@ -182,7 +182,7 @@ split_commas(FwdIt first, FwdIt last)
template <class Result = std::vector<std::string>>
Result
split_commas(std::string_view const& s)
split_commas(std::string_view s)
{
return split_commas(s.begin(), s.end());
}

View File

@@ -8,12 +8,12 @@ namespace Json {
class Value;
using Output = std::function<void(std::string_view const&)>;
using Output = std::function<void(std::string_view)>;
inline Output
stringOutput(std::string& s)
{
return [&](std::string_view const& b) { s.append(b.data(), b.size()); };
return [&](std::string_view b) { s.append(b.data(), b.size()); };
}
/** Writes a minimal representation of a Json value to an Output in O(n) time.