From d9c1162a20c4c76a6ba05e5e83fbe8531eba2c3e Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Fri, 10 Sep 2021 23:43:25 +0200 Subject: nproc: Avoid making StringView of temporary ByteBuffer --- Userland/Utilities/nproc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Userland/Utilities/nproc.cpp') diff --git a/Userland/Utilities/nproc.cpp b/Userland/Utilities/nproc.cpp index 071344069d..588b112605 100644 --- a/Userland/Utilities/nproc.cpp +++ b/Userland/Utilities/nproc.cpp @@ -22,7 +22,8 @@ int main() return 1; } - 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(); outln("{}", cpuinfo_array.size()); -- cgit v1.2.3