From fd1826cb9164dd6bbdbe82369e1697fafcb6f05a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Sep 2019 19:36:56 +0200 Subject: [PATCH] db/update/Container: move SupportsContainerSuffix() to struct DecoderPlugin --- src/db/update/Container.cxx | 10 +--------- src/decoder/DecoderPlugin.hxx | 4 ++++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/db/update/Container.cxx b/src/db/update/Container.cxx index 722bcbb8a..bfb2262a9 100644 --- a/src/db/update/Container.cxx +++ b/src/db/update/Container.cxx @@ -55,21 +55,13 @@ UpdateWalk::MakeDirectoryIfModified(Directory &parent, const char *name, return directory; } -static bool -SupportsContainerSuffix(const DecoderPlugin &plugin, - const char *suffix) noexcept -{ - return plugin.container_scan != nullptr && - plugin.SupportsSuffix(suffix); -} - bool UpdateWalk::UpdateContainerFile(Directory &directory, const char *name, const char *suffix, const StorageFileInfo &info) noexcept { const DecoderPlugin *_plugin = decoder_plugins_find([suffix](const DecoderPlugin &plugin){ - return SupportsContainerSuffix(plugin, suffix); + return plugin.SupportsContainerSuffix(suffix); }); if (_plugin == nullptr) return false; diff --git a/src/decoder/DecoderPlugin.hxx b/src/decoder/DecoderPlugin.hxx index 4b7d9e41a..1c604748c 100644 --- a/src/decoder/DecoderPlugin.hxx +++ b/src/decoder/DecoderPlugin.hxx @@ -225,6 +225,10 @@ struct DecoderPlugin { */ gcc_pure gcc_nonnull_all bool SupportsMimeType(const char *mime_type) const noexcept; + + bool SupportsContainerSuffix(const char *suffix) const noexcept { + return container_scan != nullptr && SupportsSuffix(suffix); + } }; #endif