1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:42:13 +00:00

Revert "LibDeviceTree: Propagate try_append() errors while parsing paths"

This reverts commit f064f5f36e.

As Andrew points out, this append is not actually fallible in practice,
since the loop is terminated once the vector size reaches its inline
capacity.

https://github.com/SerenityOS/serenity/pull/17606#discussion_r1117662246
This commit is contained in:
Linus Groh 2023-02-24 23:34:54 +01:00
parent b27f88f61d
commit 69f0339bac

View file

@ -113,9 +113,12 @@ static ErrorOr<ReadonlyBytes> slow_get_property_raw(StringView name, FlattenedDe
// Name is a path like /path/to/node/property
Vector<StringView, 16> path;
TRY(name.for_each_split_view('/', SplitBehavior::Nothing, [&path](StringView view) -> ErrorOr<void> {
if (path.size() == path.capacity())
if (path.size() == path.capacity()) {
return Error::from_errno(ENAMETOOLONG);
return path.try_append(view);
}
// This can never fail as all entries go into the inline buffer, enforced by the check above.
MUST(path.try_append(view));
return {};
}));
bool check_property_name = path.size() == 1; // Properties on root node should be checked immediately