1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

SystemMonitor: Avoid making StringView of temporary ByteBuffer

This commit is contained in:
Ben Wiederhake 2021-09-10 23:42:56 +02:00 committed by Idan Horowitz
parent 4ef9a1ba48
commit 2223f22590

View file

@ -26,7 +26,8 @@ ProcessModel::ProcessModel()
auto file = Core::File::construct("/proc/cpuinfo");
if (file->open(Core::OpenMode::ReadOnly)) {
auto json = JsonValue::from_string({ file->read_all() });
auto buffer = file->read_all();
auto json = JsonValue::from_string({ buffer });
auto cpuinfo_array = json.value().as_array();
cpuinfo_array.for_each([&](auto& value) {
auto& cpu_object = value.as_object();