decoder/List: eliminate decoder_plugins_try()

Migrate callers to GetEnabledDecoderPlugins().  By not using lambdas,
we can switch to enums as return value for better diagnostics.
This commit is contained in:
Max Kellermann
2024-07-11 15:50:37 +02:00
parent a27fb71c4c
commit c2470ebd9c
7 changed files with 71 additions and 62 deletions

View File

@@ -35,6 +35,7 @@
#include "Log.hxx"
#include "PluginUnavailable.hxx"
#include <algorithm> // for std::any_of()
#include <iterator>
#include <string.h>
@@ -164,7 +165,10 @@ decoder_plugin_deinit_all() noexcept
bool
decoder_plugins_supports_suffix(std::string_view suffix) noexcept
{
return decoder_plugins_try([suffix](const DecoderPlugin &plugin){
return plugin.SupportsSuffix(suffix);
});
for (const auto &plugin : GetEnabledDecoderPlugins()) {
if (plugin.SupportsSuffix(suffix))
return true;
}
return false;
}