mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
Kernel: Avoid potential allocation when enumerating cpu features
We can use `StringView::for_each_split_view` here to avoid the potential allocation of `Vector<StringView>` elements we would get from the normal Split view functions.
This commit is contained in:
parent
142e099001
commit
9592ba3548
Notes:
sideshowbarker
2024-07-17 21:07:13 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/9592ba3548d Pull-request: https://github.com/SerenityOS/serenity/pull/11785 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/creator1creeper1
@ -563,8 +563,10 @@ private:
|
||||
obj.add("family", info.display_family());
|
||||
|
||||
auto features_array = obj.add_array("features");
|
||||
for (auto& feature : info.features().split_view(' '))
|
||||
auto keep_empty = false;
|
||||
info.features().for_each_split_view(' ', keep_empty, [&](StringView feature) {
|
||||
features_array.add(feature);
|
||||
});
|
||||
features_array.finish();
|
||||
|
||||
obj.add("model", info.display_model());
|
||||
|
Loading…
Reference in New Issue
Block a user