lib/icu/Init: add class ScopeIcuInit
This commit is contained in:
parent
b8f3de693f
commit
22192adbc8
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user