1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:27:35 +00:00

LibCore: Don't needlessly use StringView in Core::Object APIs

Taking a StringView parameter that gets immediately converted to
a String anyway is silly. Just take a String directly instead.

This pattern is the main reason we have the "StringView internal
StringImpl pointer" optimization, and I suspect that we can throw
that whole thing out if we make a couple more patches like this.
This commit is contained in:
Andreas Kling 2021-04-16 19:59:31 +02:00
parent 73aa59ccf1
commit 942a5afd23
2 changed files with 5 additions and 5 deletions

View file

@ -195,7 +195,7 @@ void Object::save_to(JsonObject& json)
}
}
JsonValue Object::property(const StringView& name) const
JsonValue Object::property(String const& name) const
{
auto it = m_properties.find(name);
if (it == m_properties.end())
@ -203,7 +203,7 @@ JsonValue Object::property(const StringView& name) const
return it->value->get();
}
bool Object::set_property(const StringView& name, const JsonValue& value)
bool Object::set_property(String const& name, JsonValue const& value)
{
auto it = m_properties.find(name);
if (it == m_properties.end())