Commit eecc4403 authored by Thomas Haller's avatar Thomas Haller

core: use NM_DEFINE_SINGLETON_GETTER() macro

parent 3af40acf
......@@ -193,16 +193,7 @@ dis_connection_cb (NMDBusManager *mgr,
/***************************************************/
NMDhcpListener *
nm_dhcp_listener_get (void)
{
static NMDhcpListener *singleton = NULL;
if (G_UNLIKELY (singleton == NULL))
singleton = g_object_new (NM_TYPE_DHCP_LISTENER, NULL);
g_assert (singleton);
return singleton;
}
NM_DEFINE_SINGLETON_GETTER (NMDhcpListener, nm_dhcp_listener_get, NM_TYPE_DHCP_LISTENER);
static void
nm_dhcp_listener_init (NMDhcpListener *self)
......
......@@ -50,7 +50,7 @@ typedef struct {
G_DEFINE_TYPE (NMDefaultRouteManager, nm_default_route_manager, G_TYPE_OBJECT)
static NMDefaultRouteManager *singleton_instance;
NM_DEFINE_SINGLETON_GETTER (NMDefaultRouteManager, nm_default_route_manager_get, NM_TYPE_DEFAULT_ROUTE_MANAGER);
#define _LOG(level, addr_family, ...) \
G_STMT_START { \
......@@ -1154,18 +1154,6 @@ static const VTableIP vtable_ip6 = {
/***********************************************************************************/
NMDefaultRouteManager *
nm_default_route_manager_get ()
{
if (G_UNLIKELY (!singleton_instance)) {
singleton_instance = NM_DEFAULT_ROUTE_MANAGER (g_object_new (NM_TYPE_DEFAULT_ROUTE_MANAGER, NULL));
g_object_add_weak_pointer (G_OBJECT (singleton_instance), (gpointer *) &singleton_instance);
}
return singleton_instance;
}
/***********************************************************************************/
static gboolean
_resync_idle_now (NMDefaultRouteManager *self)
{
......
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