mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 14:18:12 +02:00
all: use cast macros instead of C cast
When building with assertions, they nm_assert() for the
type. Otherwise, they are identical to a C cast.
Also, where possible, don't cast at all, but adjust
the type instead.
Also, there were a few missing casts.
(cherry picked from commit 7661ad64ba)
This commit is contained in:
parent
4bd3069b68
commit
ceeeb51e1d
5 changed files with 14 additions and 13 deletions
|
|
@ -477,9 +477,9 @@ updated_get_settings_cb (DBusGProxy *proxy,
|
||||||
priv->visible = FALSE;
|
priv->visible = FALSE;
|
||||||
g_signal_emit (self, signals[VISIBLE], 0, FALSE);
|
g_signal_emit (self, signals[VISIBLE], 0, FALSE);
|
||||||
} else {
|
} else {
|
||||||
gs_unref_object NMConnection *self_alive = NULL;
|
gs_unref_object NMRemoteConnection *self_alive = NULL;
|
||||||
|
|
||||||
self_alive = (NMConnection*)g_object_ref (self);
|
self_alive = g_object_ref (self);
|
||||||
_nm_connection_replace_settings (NM_CONNECTION (self), new_settings);
|
_nm_connection_replace_settings (NM_CONNECTION (self), new_settings);
|
||||||
g_signal_emit (self, signals[UPDATED], 0, new_settings);
|
g_signal_emit (self, signals[UPDATED], 0, new_settings);
|
||||||
g_hash_table_destroy (new_settings);
|
g_hash_table_destroy (new_settings);
|
||||||
|
|
@ -601,9 +601,10 @@ constructed (GObject *object)
|
||||||
static gboolean
|
static gboolean
|
||||||
init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
||||||
{
|
{
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
|
NMRemoteConnection *self = NM_REMOTE_CONNECTION (initable);
|
||||||
|
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
gs_unref_object NMConnection *self_alive = NULL;
|
gs_unref_object NMRemoteConnection *self_alive = NULL;
|
||||||
|
|
||||||
if (!dbus_g_proxy_call (priv->proxy, "GetSettings", error,
|
if (!dbus_g_proxy_call (priv->proxy, "GetSettings", error,
|
||||||
G_TYPE_INVALID,
|
G_TYPE_INVALID,
|
||||||
|
|
@ -611,9 +612,9 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
||||||
G_TYPE_INVALID))
|
G_TYPE_INVALID))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
priv->visible = TRUE;
|
priv->visible = TRUE;
|
||||||
self_alive = (NMConnection*)g_object_ref (initable);
|
self_alive = g_object_ref (self);
|
||||||
_nm_connection_replace_settings (NM_CONNECTION (initable), hash);
|
_nm_connection_replace_settings (NM_CONNECTION (self), hash);
|
||||||
g_signal_emit (initable, signals[UPDATED], 0, hash);
|
g_signal_emit (self, signals[UPDATED], 0, hash);
|
||||||
g_hash_table_destroy (hash);
|
g_hash_table_destroy (hash);
|
||||||
|
|
||||||
/* Get properties */
|
/* Get properties */
|
||||||
|
|
@ -676,7 +677,7 @@ init_get_settings_cb (DBusGProxy *proxy,
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
|
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
|
||||||
GHashTable *settings;
|
GHashTable *settings;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gs_unref_object NMConnection *self_alive = NULL;
|
gs_unref_object NMRemoteConnection *self_alive = NULL;
|
||||||
|
|
||||||
dbus_g_proxy_end_call (proxy, call, &error,
|
dbus_g_proxy_end_call (proxy, call, &error,
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
|
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
|
||||||
|
|
@ -687,7 +688,7 @@ init_get_settings_cb (DBusGProxy *proxy,
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->visible = TRUE;
|
priv->visible = TRUE;
|
||||||
self_alive = (NMConnection*)g_object_ref (init_data->connection);
|
self_alive = g_object_ref (init_data->connection);
|
||||||
_nm_connection_replace_settings (NM_CONNECTION (init_data->connection), settings);
|
_nm_connection_replace_settings (NM_CONNECTION (init_data->connection), settings);
|
||||||
g_signal_emit (init_data->connection, signals[UPDATED], 0, settings);
|
g_signal_emit (init_data->connection, signals[UPDATED], 0, settings);
|
||||||
g_hash_table_destroy (settings);
|
g_hash_table_destroy (settings);
|
||||||
|
|
|
||||||
|
|
@ -202,5 +202,5 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
|
||||||
G_MODULE_EXPORT GObject *
|
G_MODULE_EXPORT GObject *
|
||||||
nm_settings_plugin_factory (void)
|
nm_settings_plugin_factory (void)
|
||||||
{
|
{
|
||||||
return (GObject*)g_object_ref (nms_ibft_plugin_get ());
|
return G_OBJECT (g_object_ref (nms_ibft_plugin_get ()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1080,5 +1080,5 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
|
||||||
G_MODULE_EXPORT GObject *
|
G_MODULE_EXPORT GObject *
|
||||||
nm_settings_plugin_factory (void)
|
nm_settings_plugin_factory (void)
|
||||||
{
|
{
|
||||||
return (GObject*)g_object_ref (settings_plugin_ifcfg_get ());
|
return G_OBJECT (g_object_ref (settings_plugin_ifcfg_get ()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -520,5 +520,5 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
|
||||||
G_MODULE_EXPORT GObject *
|
G_MODULE_EXPORT GObject *
|
||||||
nm_settings_plugin_factory (void)
|
nm_settings_plugin_factory (void)
|
||||||
{
|
{
|
||||||
return g_object_ref (settings_plugin_ifnet_get ());
|
return G_OBJECT (g_object_ref (settings_plugin_ifnet_get ()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -541,6 +541,6 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
|
||||||
G_MODULE_EXPORT GObject *
|
G_MODULE_EXPORT GObject *
|
||||||
nm_settings_plugin_factory (void)
|
nm_settings_plugin_factory (void)
|
||||||
{
|
{
|
||||||
return g_object_ref (settings_plugin_ifupdown_get ());
|
return G_OBJECT (g_object_ref (settings_plugin_ifupdown_get ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue