refactor: Pass singleton instance directly

This commit is contained in:
Michael Carlberg 2016-12-09 12:25:25 +01:00
parent 5d5542169b
commit bff119834a
3 changed files with 4 additions and 6 deletions

View File

@ -8,8 +8,7 @@ signal_receivers_t g_signal_receivers;
* Create instance * Create instance
*/ */
signal_emitter::make_type signal_emitter::make() { signal_emitter::make_type signal_emitter::make() {
auto instance = factory_util::singleton<signal_emitter>(); return static_cast<signal_emitter&>(*factory_util::singleton<signal_emitter>());
return static_cast<signal_emitter&>(*instance);
} }
POLYBAR_NS_END POLYBAR_NS_END

View File

@ -12,8 +12,8 @@ POLYBAR_NS
* Create instance * Create instance
*/ */
connection::make_type connection::make() { connection::make_type connection::make() {
auto instance = factory_util::singleton<connection>(xutils::get_connection(), xutils::get_connection_fd()); return static_cast<connection&>(
return static_cast<connection&>(*instance); *factory_util::singleton<connection>(xutils::get_connection(), xutils::get_connection_fd()));
} }
/** /**

View File

@ -12,8 +12,7 @@ POLYBAR_NS
* Create instance * Create instance
*/ */
const xresource_manager& xresource_manager::make() { const xresource_manager& xresource_manager::make() {
auto instance = factory_util::singleton<xresource_manager>(); return static_cast<const xresource_manager&>(*factory_util::singleton<xresource_manager>());
return static_cast<const xresource_manager&>(*instance);
} }
/** /**