summaryrefslogtreecommitdiff
path: root/Userland/Utilities/nproc.cpp
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-09-10 23:43:25 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2021-09-11 13:22:51 +0300
commitd9c1162a20c4c76a6ba05e5e83fbe8531eba2c3e (patch)
tree2187302c05610ce214de7e18f56032901b7b256c /Userland/Utilities/nproc.cpp
parent6c8eea6f5edc87c76a1669bc4a02ebf254304c1e (diff)
downloadserenity-d9c1162a20c4c76a6ba05e5e83fbe8531eba2c3e.zip
nproc: Avoid making StringView of temporary ByteBuffer
Diffstat (limited to 'Userland/Utilities/nproc.cpp')
-rw-r--r--Userland/Utilities/nproc.cpp3
1 files changed, 2 insertions, 1 deletions
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());