Commit 22192adb authored by Max Kellermann's avatar Max Kellermann

lib/icu/Init: add class ScopeIcuInit

parent b8f3de69
......@@ -466,8 +466,7 @@ MainOrThrow(int argc, char *argv[])
#endif
#endif
IcuInit();
const ScopeIcuInit icu_init;
const ScopeNetInit net_init;
#ifdef ENABLE_DBUS
......@@ -720,8 +719,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
daemonize_finish();
#endif
IcuFinish();
return EXIT_SUCCESS;
}
......
......@@ -37,4 +37,18 @@ static inline void IcuFinish() noexcept {}
#endif
class ScopeIcuInit {
public:
ScopeIcuInit() {
IcuInit();
}
~ScopeIcuInit() noexcept {
IcuFinish();
}
ScopeIcuInit(const ScopeIcuInit &) = delete;
ScopeIcuInit &operator=(const ScopeIcuInit &) = delete;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment