From c7ea710b5560d1e1c85fd983cd03df183cdb3a76 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 3 Apr 2024 21:28:20 -0400 Subject: [PATCH] AK: Return a constant reference from JsonValue::as_string Rather than making a copy of the held string, this returns a reference so that expressions like the following: do_something(json.as_string().view()); are not disallowed once `ByteString::view() &&` is deleted. --- AK/JsonValue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/JsonValue.h b/AK/JsonValue.h index 7faf48d3c61..fc6b84099d9 100644 --- a/AK/JsonValue.h +++ b/AK/JsonValue.h @@ -128,7 +128,7 @@ public: return m_value.get(); } - ByteString as_string() const + ByteString const& as_string() const { return m_value.get(); }