1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Kernel: Fix CPUInfo error propagation fixme

We can now propagate the errors directly from for_each_split_view(),
which I think counts as "Make this nicer" :^)
This commit is contained in:
MacDue 2023-02-05 16:13:29 +00:00 committed by Andreas Kling
parent 012aaecccf
commit 83a59396c8

View file

@ -40,13 +40,9 @@ ErrorOr<void> SysFSCPUInformation::try_generate(KBufferBuilder& builder)
auto features_array = TRY(obj.add_array("features"sv));
auto keep_empty = SplitBehavior::KeepEmpty;
ErrorOr<void> result; // FIXME: Make this nicer
info.features_string().for_each_split_view(' ', keep_empty, [&](StringView feature) {
if (result.is_error())
return;
result = features_array.add(feature);
});
TRY(result);
TRY(info.features_string().for_each_split_view(' ', keep_empty, [&](StringView feature) {
return features_array.add(feature);
}));
TRY(features_array.finish());