diff options
author | Max Kellermann <max@musicpd.org> | 2019-02-05 22:11:45 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-02-05 22:12:22 +0100 |
commit | 7a23c123c8b3b24ea61157e10b2ffd3ae44c5acf (patch) | |
tree | 1615288af12ddbe04edfed0b43f617b8e6edd2b7 /src/decoder | |
parent | e85b24bee0004f6e18c986fa718b2854fee57730 (diff) |
decoder/List: add RAII class
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/DecoderList.hxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/decoder/DecoderList.hxx b/src/decoder/DecoderList.hxx index 7f0313bd6..f64d51378 100644 --- a/src/decoder/DecoderList.hxx +++ b/src/decoder/DecoderList.hxx @@ -42,6 +42,17 @@ decoder_plugin_init_all(const ConfigData &config); void decoder_plugin_deinit_all() noexcept; +class ScopeDecoderPluginsInit { +public: + explicit ScopeDecoderPluginsInit(const ConfigData &config) { + decoder_plugin_init_all(config); + } + + ~ScopeDecoderPluginsInit() noexcept { + decoder_plugin_deinit_all(); + } +}; + template<typename F> static inline const DecoderPlugin * decoder_plugins_find(F f) noexcept |