mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
Userland: Avoid a bunch of JsonObject copies
JsonValue::as_object() returns a reference.
This commit is contained in:
parent
a6248101e2
commit
16d51d78c0
11 changed files with 12 additions and 13 deletions
|
@ -7,7 +7,6 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -24,7 +23,7 @@ int main()
|
|||
auto json = JsonValue::from_string(file_contents);
|
||||
VERIFY(json.has_value());
|
||||
json.value().as_array().for_each([](auto& value) {
|
||||
auto if_object = value.as_object();
|
||||
auto& if_object = value.as_object();
|
||||
|
||||
auto ip_address = if_object.get("ip_address").to_string();
|
||||
auto mac_address = if_object.get("mac_address").to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue