all: g_hash_table_add doesn't return a value before 2.40

This commit is contained in:
Lubomir Rintel
2015-09-30 13:29:55 +02:00
parent 3227778d89
commit 36e5c0a821
3 changed files with 20 additions and 0 deletions

View File

@@ -873,8 +873,12 @@ nm_bus_manager_register_object (NMBusManager *self,
* stable -- because the path is the identifier for the object in this
* situation. */
#if GLIB_CHECK_VERSION(2, 40, 0)
if (!g_hash_table_insert (priv->exported, (gpointer) path, object))
g_return_if_reached ();
#else
g_hash_table_insert (priv->exported, (gpointer) path, object);
#endif
nm_assert_exported (self, path, object);

View File

@@ -163,8 +163,12 @@ _cb_info_create (NMFirewallManager *self,
} else
info->mode = CB_INFO_MODE_IDLE;
#if GLIB_CHECK_VERSION(2, 40, 0)
if (!g_hash_table_add (priv->pending_calls, info))
g_return_val_if_reached (NULL);
#else
g_hash_table_add (priv->pending_calls, info);
#endif
return info;
}

View File

@@ -1216,8 +1216,12 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
req->con.get.callback = callback;
req->con.get.callback_data = callback_data;
#if GLIB_CHECK_VERSION(2, 40, 0)
if (!g_hash_table_add (priv->requests, req))
g_assert_not_reached ();
#else
g_hash_table_add (priv->requests, req);
#endif
/* Kick off the request */
if (!(req->con.get.flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM))
@@ -1322,8 +1326,12 @@ nm_agent_manager_save_secrets (NMAgentManager *self,
subject);
req->con.path = g_strdup (path);
req->con.connection = g_object_ref (connection);
#if GLIB_CHECK_VERSION(2, 40, 0)
if (!g_hash_table_add (priv->requests, req))
g_assert_not_reached ();
#else
g_hash_table_add (priv->requests, req);
#endif
/* Kick off the request */
request_add_agents (self, req);
@@ -1410,8 +1418,12 @@ nm_agent_manager_delete_secrets (NMAgentManager *self,
req->con.path = g_strdup (path);
req->con.connection = g_object_ref (connection);
g_object_unref (subject);
#if GLIB_CHECK_VERSION(2, 40, 0)
if (!g_hash_table_add (priv->requests, req))
g_assert_not_reached ();
#else
g_hash_table_add (priv->requests, req);
#endif
/* Kick off the request */
request_add_agents (self, req);