summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-12-22 14:27:48 +0000
committerTim Flynn <trflynn89@pm.me>2023-02-03 07:19:52 -0500
commitf63eaee20c5d1028be8d1054897b8210d3ee7e7d (patch)
tree6b912dd3099ec3325297e42c44a0a1600f783b5a
parent08c26e988ae95dc8f9913cb51dd155cd6c4f2ca4 (diff)
downloadserenity-f63eaee20c5d1028be8d1054897b8210d3ee7e7d.zip
Utilities/ifconfig: Replace uses of JsonObject::get_deprecated()/get_ptr
-rw-r--r--Userland/Utilities/ifconfig.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Utilities/ifconfig.cpp b/Userland/Utilities/ifconfig.cpp
index f8c756b6f1..5b8dc637a3 100644
--- a/Userland/Utilities/ifconfig.cpp
+++ b/Userland/Utilities/ifconfig.cpp
@@ -38,16 +38,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
json.as_array().for_each([](auto& value) {
auto& if_object = value.as_object();
- auto name = if_object.get_deprecated("name"sv).to_deprecated_string();
- auto class_name = if_object.get_deprecated("class_name"sv).to_deprecated_string();
- auto mac_address = if_object.get_deprecated("mac_address"sv).to_deprecated_string();
- auto ipv4_address = if_object.get_deprecated("ipv4_address"sv).to_deprecated_string();
- auto netmask = if_object.get_deprecated("ipv4_netmask"sv).to_deprecated_string();
- auto packets_in = if_object.get_deprecated("packets_in"sv).to_u32();
- auto bytes_in = if_object.get_deprecated("bytes_in"sv).to_u32();
- auto packets_out = if_object.get_deprecated("packets_out"sv).to_u32();
- auto bytes_out = if_object.get_deprecated("bytes_out"sv).to_u32();
- auto mtu = if_object.get_deprecated("mtu"sv).to_u32();
+ auto name = if_object.get_deprecated_string("name"sv).value_or({});
+ auto class_name = if_object.get_deprecated_string("class_name"sv).value_or({});
+ auto mac_address = if_object.get_deprecated_string("mac_address"sv).value_or({});
+ auto ipv4_address = if_object.get_deprecated_string("ipv4_address"sv).value_or({});
+ auto netmask = if_object.get_deprecated_string("ipv4_netmask"sv).value_or({});
+ auto packets_in = if_object.get_u32("packets_in"sv).value_or(0);
+ auto bytes_in = if_object.get_u32("bytes_in"sv).value_or(0);
+ auto packets_out = if_object.get_u32("packets_out"sv).value_or(0);
+ auto bytes_out = if_object.get_u32("bytes_out"sv).value_or(0);
+ auto mtu = if_object.get_u32("mtu"sv).value_or(0);
outln("{}:", name);
outln("\tmac: {}", mac_address);