-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Traverse the filesystem only once when looking for UDI and Subiquity snaps. #258
Conversation
that function seems more like std::any_of than std::find_if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy
in the new code
clang-format
found formatting issues in the code submitted.:warning:
Make sure to run clang-format and update this pull request.
(1/1)
5cd9d0a
to
2b57149
Compare
2b57149
to
ae20aff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor performance comment
Co-authored-by: Edu Gómez Escandell <edu.gomez.escandell@canonical.com>
Here is the key of this PR:
For that to be possible,
hasAnyOfSnaps()
has to be implemented as a template function that can accept a variadic number ofstring_view
arguments and applies the existing algorithms to find entries inside the snap directory matching one of the supplied arguments. Since that receives a variadic argument in order to nicely composefind_file_if
andstd::any_of
we put together apush_back_many
algorithm that populates a vector of string_views from a variadic argument list.BTW,
find_file_if
returns a bool instead of iterator, so more likestd::any_of
thanstd::find_if
, thus the function was renamed toany_file_of
.And since there were some documentation comments lacking on the
algorithms.h
header and some unevitable linter complains about parameters of the same type instarts/ends_with
algorithms, I put some comments to stop linter at those lines.I think it is easier to review this PR commit by commit.