mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
SystemMonitor: Avoid making StringView of temporary ByteBuffer
This commit is contained in:
committed by
Idan Horowitz
parent
4ef9a1ba48
commit
2223f22590
Notes:
sideshowbarker
2024-07-18 04:17:40 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/2223f22590f Pull-request: https://github.com/SerenityOS/serenity/pull/9946 Reviewed-by: https://github.com/IdanHo ✅
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user