mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 10:14:41 +00:00
all: use nm_clear_pointer() instead of g_clear_pointer()
g_clear_pointer() would always cast the destroy notify function
pointer to GDestroyNotify. That means, it lost some type safety, like
GPtrArray *ptr_arr = ...
g_clear_pointer (&ptr_arr, g_array_unref);
Since glib 2.58 ([1]), g_clear_pointer() is also more type safe. But
this is not used by NetworkManager, because we don't set
GLIB_VERSION_MIN_REQUIRED to 2.58.
[1] f9a9902aac
We have nm_clear_pointer() to avoid this issue for a long time (pre
1.12.0). Possibly we should redefine in our source tree g_clear_pointer()
as nm_clear_pointer(). However, I don't like to patch glib functions
with our own variant. Arguably, we do patch g_clear_error() in
such a manner. But there the point is to make the function inlinable.
Also, nm_clear_pointer() returns a boolean that indicates whether
anything was cleared. That is sometimes useful. I think we should
just consistently use nm_clear_pointer() instead, which does always
the preferable thing.
Replace:
sed 's/\<g_clear_pointer *(\([^;]*\), *\([a-z_A-Z0-9]\+\) *)/nm_clear_pointer (\1, \2)/g' $(git grep -l g_clear_pointer) -i
This commit is contained in:
parent
073994ca42
commit
52dbab7d07
|
@ -423,7 +423,7 @@ _metagen_con_show_row_data_init_primary_active (MetagenConShowRowData *row_data)
|
|||
g_object_unref (row_data->primary_active);
|
||||
row_data->primary_active = g_object_ref (best_ac);
|
||||
}
|
||||
g_clear_pointer (&row_data->all_active, g_ptr_array_unref);
|
||||
nm_clear_pointer (&row_data->all_active, g_ptr_array_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -436,7 +436,7 @@ _metagen_con_show_row_data_destroy (gpointer data)
|
|||
|
||||
g_clear_object (&row_data->connection);
|
||||
g_clear_object (&row_data->primary_active);
|
||||
g_clear_pointer (&row_data->all_active, g_ptr_array_unref);
|
||||
nm_clear_pointer (&row_data->all_active, g_ptr_array_unref);
|
||||
g_slice_free (MetagenConShowRowData, row_data);
|
||||
}
|
||||
|
||||
|
@ -9246,7 +9246,7 @@ nmcli_con_tab_completion (const char *text, int start, int end)
|
|||
if (generator_func)
|
||||
match_array = rl_completion_matches (text, generator_func);
|
||||
|
||||
g_clear_pointer (&nmc_tab_completion.words, g_strfreev);
|
||||
nm_clear_pointer (&nmc_tab_completion.words, g_strfreev);
|
||||
return match_array;
|
||||
}
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ main (int argc, char *argv[])
|
|||
nm_clear_g_signal_handler (data.client, &data.client_notify_id);
|
||||
g_clear_object (&data.client);
|
||||
|
||||
g_clear_pointer (&data.loop, g_main_loop_unref);
|
||||
nm_clear_pointer (&data.loop, g_main_loop_unref);
|
||||
|
||||
if (!data.quiet)
|
||||
_print_progress (data.wait_startup, -1, NM_MAX (0, data.end_timestamp_ms - _now_ms ()), data.retval);
|
||||
|
|
|
@ -175,8 +175,8 @@ nmt_password_dialog_finalize (GObject *object)
|
|||
|
||||
g_free (priv->request_id);
|
||||
g_free (priv->prompt);
|
||||
g_clear_pointer (&priv->entries, g_ptr_array_unref);
|
||||
g_clear_pointer (&priv->secrets, g_ptr_array_unref);
|
||||
nm_clear_pointer (&priv->entries, g_ptr_array_unref);
|
||||
nm_clear_pointer (&priv->secrets, g_ptr_array_unref);
|
||||
|
||||
G_OBJECT_CLASS (nmt_password_dialog_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ nmt_route_entry_finalize (GObject *object)
|
|||
{
|
||||
NmtRouteEntryPrivate *priv = NMT_ROUTE_ENTRY_GET_PRIVATE (object);
|
||||
|
||||
g_clear_pointer (&priv->route, nm_ip_route_unref);
|
||||
nm_clear_pointer (&priv->route, nm_ip_route_unref);
|
||||
|
||||
G_OBJECT_CLASS (nmt_route_entry_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -1090,7 +1090,7 @@ done:
|
|||
nm_clear_g_source (&signal_id_term);
|
||||
nm_clear_g_source (&signal_id_int);
|
||||
nm_clear_g_source (&gl.quit_id);
|
||||
g_clear_pointer (&gl.loop, g_main_loop_unref);
|
||||
nm_clear_pointer (&gl.loop, g_main_loop_unref);
|
||||
g_clear_object (&gl.dbus_connection);
|
||||
|
||||
if (!gl.debug)
|
||||
|
|
|
@ -1914,7 +1914,7 @@ nm_connection_update_secrets (NMConnection *connection,
|
|||
error);
|
||||
g_signal_handlers_unblock_by_func (setting, (GCallback) setting_changed_cb, connection);
|
||||
|
||||
g_clear_pointer (&setting_dict, g_variant_unref);
|
||||
nm_clear_pointer (&setting_dict, g_variant_unref);
|
||||
|
||||
if (success_detail == NM_SETTING_UPDATE_SECRET_ERROR) {
|
||||
nm_assert (!error || *error);
|
||||
|
|
|
@ -327,7 +327,7 @@ out:
|
|||
/* setting a value purges all invalid values that were set
|
||||
* via GObject property. */
|
||||
changed = TRUE;
|
||||
g_clear_pointer (&priv->data_invalid, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->data_invalid, g_hash_table_unref);
|
||||
}
|
||||
if (changed)
|
||||
_notify (self, PROP_DATA);
|
||||
|
@ -462,8 +462,8 @@ set_property (GObject *object, guint prop_id,
|
|||
|
||||
data = g_value_get_boxed (value);
|
||||
if (!data || !g_hash_table_size (data)) {
|
||||
g_clear_pointer (&priv->data, g_hash_table_unref);
|
||||
g_clear_pointer (&priv->data_invalid, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->data, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->data_invalid, g_hash_table_unref);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ set_property (GObject *object, guint prop_id,
|
|||
}
|
||||
if ( priv->data_invalid
|
||||
&& !g_hash_table_size (priv->data_invalid))
|
||||
g_clear_pointer (&priv->data_invalid, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->data_invalid, g_hash_table_unref);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -183,7 +183,7 @@ set_property (GObject *object, guint prop_id,
|
|||
priv->wps_method = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_WFD_IES:
|
||||
g_clear_pointer (&priv->wfd_ies, g_bytes_unref);
|
||||
nm_clear_pointer (&priv->wfd_ies, g_bytes_unref);
|
||||
priv->wfd_ies = g_value_dup_boxed (value);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1176,7 +1176,7 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
}
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->keyfile, g_key_file_unref);
|
||||
nm_clear_pointer (&priv->keyfile, g_key_file_unref);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1261,7 +1261,7 @@ finalize (GObject *object)
|
|||
g_free (priv->filename);
|
||||
g_hash_table_unref (priv->keys);
|
||||
|
||||
g_clear_pointer (&priv->keyfile, g_key_file_unref);
|
||||
nm_clear_pointer (&priv->keyfile, g_key_file_unref);
|
||||
|
||||
G_OBJECT_CLASS (nm_vpn_plugin_info_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -3500,7 +3500,7 @@ test_setting_compare_addresses (void)
|
|||
|
||||
success = nm_setting_diff (s1, s2, NM_SETTING_COMPARE_FLAG_EXACT, FALSE, &result);
|
||||
g_assert (!success);
|
||||
g_clear_pointer (&result, g_hash_table_unref);
|
||||
nm_clear_pointer (&result, g_hash_table_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3532,7 +3532,7 @@ test_setting_compare_routes (void)
|
|||
|
||||
success = nm_setting_diff (s1, s2, NM_SETTING_COMPARE_FLAG_EXACT, FALSE, &result);
|
||||
g_assert (!success);
|
||||
g_clear_pointer (&result, g_hash_table_unref);
|
||||
nm_clear_pointer (&result, g_hash_table_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -99,7 +99,7 @@ test_encode_key (void)
|
|||
GKeyFile **_keyfile = (keyfile); \
|
||||
\
|
||||
g_clear_object (_con); \
|
||||
g_clear_pointer (_keyfile, g_key_file_unref); \
|
||||
nm_clear_pointer (_keyfile, g_key_file_unref); \
|
||||
} G_STMT_END
|
||||
|
||||
static void
|
||||
|
|
|
@ -329,7 +329,7 @@ finalize (GObject *object)
|
|||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (object);
|
||||
|
||||
g_clear_pointer (&priv->lldp_neighbors, g_ptr_array_unref);
|
||||
nm_clear_pointer (&priv->lldp_neighbors, g_ptr_array_unref);
|
||||
|
||||
g_free (priv->interface);
|
||||
g_free (priv->ip_interface);
|
||||
|
|
|
@ -963,10 +963,10 @@ finalize (GObject *object)
|
|||
nm_vpn_plugin_old_set_connection (plugin, NULL);
|
||||
g_free (priv->dbus_service_name);
|
||||
|
||||
g_clear_pointer (&priv->banner, g_variant_unref);
|
||||
g_clear_pointer (&priv->tundev, g_variant_unref);
|
||||
g_clear_pointer (&priv->gateway, g_variant_unref);
|
||||
g_clear_pointer (&priv->mtu, g_variant_unref);
|
||||
nm_clear_pointer (&priv->banner, g_variant_unref);
|
||||
nm_clear_pointer (&priv->tundev, g_variant_unref);
|
||||
nm_clear_pointer (&priv->gateway, g_variant_unref);
|
||||
nm_clear_pointer (&priv->mtu, g_variant_unref);
|
||||
|
||||
G_OBJECT_CLASS (nm_vpn_plugin_old_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -1145,10 +1145,10 @@ finalize (GObject *object)
|
|||
nm_vpn_service_plugin_set_connection (plugin, NULL);
|
||||
g_free (priv->dbus_service_name);
|
||||
|
||||
g_clear_pointer (&priv->banner, g_variant_unref);
|
||||
g_clear_pointer (&priv->tundev, g_variant_unref);
|
||||
g_clear_pointer (&priv->gateway, g_variant_unref);
|
||||
g_clear_pointer (&priv->mtu, g_variant_unref);
|
||||
nm_clear_pointer (&priv->banner, g_variant_unref);
|
||||
nm_clear_pointer (&priv->tundev, g_variant_unref);
|
||||
nm_clear_pointer (&priv->gateway, g_variant_unref);
|
||||
nm_clear_pointer (&priv->mtu, g_variant_unref);
|
||||
|
||||
G_OBJECT_CLASS (nm_vpn_service_plugin_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ test_wifi_ap_added_removed (void)
|
|||
NULL,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_clear_pointer (&ret, g_variant_unref);
|
||||
nm_clear_pointer (&ret, g_variant_unref);
|
||||
|
||||
g_signal_connect (wifi,
|
||||
"access-point-removed",
|
||||
|
@ -590,7 +590,7 @@ test_client_nm_running (void)
|
|||
g_source_remove (quit_id);
|
||||
|
||||
/* And kill it */
|
||||
g_clear_pointer (&sinfo, nmtstc_service_cleanup);
|
||||
nm_clear_pointer (&sinfo, nmtstc_service_cleanup);
|
||||
|
||||
g_assert (nm_client_get_nm_running (client1));
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ test_secret_agent_get_secrets (NMSecretAgentOld *agent,
|
|||
done:
|
||||
callback (agent, connection, secrets, error, callback_data);
|
||||
g_clear_error (&error);
|
||||
g_clear_pointer (&secrets, g_variant_unref);
|
||||
nm_clear_pointer (&secrets, g_variant_unref);
|
||||
g_free (secret);
|
||||
}
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ dispose (GObject *object)
|
|||
|
||||
for (iter = priv->devices; iter; iter = iter->next)
|
||||
g_object_weak_unref (G_OBJECT (iter->data), device_destroyed, self);
|
||||
g_clear_pointer (&priv->devices, g_slist_free);
|
||||
nm_clear_pointer (&priv->devices, g_slist_free);
|
||||
|
||||
priv->udev_client = nm_udev_client_unref (priv->udev_client);
|
||||
|
||||
|
|
|
@ -173,8 +173,8 @@ static GHashTable *factories_by_setting = NULL;
|
|||
static void __attribute__((destructor))
|
||||
_cleanup (void)
|
||||
{
|
||||
g_clear_pointer (&factories_by_link, g_hash_table_unref);
|
||||
g_clear_pointer (&factories_by_setting, g_hash_table_unref);
|
||||
nm_clear_pointer (&factories_by_link, g_hash_table_unref);
|
||||
nm_clear_pointer (&factories_by_setting, g_hash_table_unref);
|
||||
}
|
||||
|
||||
NMDeviceFactory *
|
||||
|
|
|
@ -8509,7 +8509,7 @@ shared_ip_release (gpointer data)
|
|||
{
|
||||
g_hash_table_remove (shared_ips, data);
|
||||
if (!g_hash_table_size (shared_ips))
|
||||
g_clear_pointer (&shared_ips, g_hash_table_unref);
|
||||
nm_clear_pointer (&shared_ips, g_hash_table_unref);
|
||||
}
|
||||
|
||||
static NMIP4Config *
|
||||
|
@ -10199,7 +10199,7 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
|
|||
nm_assert (!applied_config_get_current (&priv->ac_ip6_config));
|
||||
applied_config_clear (&priv->ac_ip6_config);
|
||||
|
||||
g_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_g_source (&priv->rt6_temporary_not_available_id);
|
||||
|
||||
s_ip6 = NM_SETTING_IP6_CONFIG (nm_connection_get_setting_ip6_config (connection));
|
||||
|
@ -10250,7 +10250,7 @@ addrconf6_cleanup (NMDevice *self)
|
|||
nm_clear_g_signal_handler (priv->ndisc, &priv->ndisc_timeout_id);
|
||||
|
||||
applied_config_clear (&priv->ac_ip6_config);
|
||||
g_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_g_source (&priv->rt6_temporary_not_available_id);
|
||||
g_clear_object (&priv->ndisc);
|
||||
}
|
||||
|
@ -12365,7 +12365,7 @@ _rt6_temporary_not_available_set (NMDevice *self,
|
|||
if ( !temporary_not_available
|
||||
|| !temporary_not_available->len) {
|
||||
/* nothing outstanding. Clear tracking the routes. */
|
||||
g_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_g_source (&priv->rt6_temporary_not_available_id);
|
||||
return success;
|
||||
}
|
||||
|
@ -15166,7 +15166,7 @@ _cleanup_generic_post (NMDevice *self, CleanupType cleanup_type)
|
|||
priv->ipv6ll_has = FALSE;
|
||||
memset (&priv->ipv6ll_addr, 0, sizeof (priv->ipv6ll_addr));
|
||||
|
||||
g_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
|
||||
nm_clear_g_source (&priv->rt6_temporary_not_available_id);
|
||||
|
||||
g_slist_free_full (priv->vpn_configs_4, g_object_unref);
|
||||
|
|
|
@ -349,7 +349,7 @@ lldp_neighbor_free (LldpNeighbor *neighbor)
|
|||
;
|
||||
}
|
||||
}
|
||||
g_clear_pointer (&neighbor->variant, g_variant_unref);
|
||||
nm_clear_pointer (&neighbor->variant, g_variant_unref);
|
||||
g_slice_free (LldpNeighbor, neighbor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1624,9 +1624,9 @@ dispose (GObject *object)
|
|||
priv->calls = NULL;
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->bridges, g_hash_table_destroy);
|
||||
g_clear_pointer (&priv->ports, g_hash_table_destroy);
|
||||
g_clear_pointer (&priv->interfaces, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->bridges, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->ports, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->interfaces, g_hash_table_destroy);
|
||||
|
||||
G_OBJECT_CLASS (nm_ovsdb_parent_class)->dispose (object);
|
||||
}
|
||||
|
|
|
@ -501,7 +501,7 @@ test_recv (TestRecvFixture *fixture, gconstpointer user_data)
|
|||
data->check (loop, listener);
|
||||
|
||||
nm_clear_g_source (&sd_id);
|
||||
g_clear_pointer (&loop, g_main_loop_unref);
|
||||
nm_clear_pointer (&loop, g_main_loop_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -324,7 +324,7 @@ connect_context_clear (NMModemBroadband *self)
|
|||
ConnectContext *ctx = self->_priv.ctx;
|
||||
|
||||
g_clear_error (&ctx->first_error);
|
||||
g_clear_pointer (&ctx->ip_types, g_array_unref);
|
||||
nm_clear_pointer (&ctx->ip_types, g_array_unref);
|
||||
nm_clear_g_cancellable (&ctx->cancellable);
|
||||
g_clear_object (&ctx->connection);
|
||||
g_clear_object (&ctx->connect_properties);
|
||||
|
|
|
@ -769,7 +769,7 @@ stage1_prepare_done (GObject *source,
|
|||
|
||||
g_clear_object (&priv->context_proxy_cancellable);
|
||||
|
||||
g_clear_pointer (&priv->connect_properties, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->connect_properties, g_hash_table_destroy);
|
||||
|
||||
if (error) {
|
||||
_LOGW ("connection failed: %s", error->message);
|
||||
|
|
|
@ -925,7 +925,7 @@ nm_dhcp_client_handle_event (gpointer unused,
|
|||
&& !ip_config) {
|
||||
_LOGW ("client bound but IP config not received");
|
||||
new_state = NM_DHCP_STATE_FAIL;
|
||||
g_clear_pointer (&str_options, g_hash_table_unref);
|
||||
nm_clear_pointer (&str_options, g_hash_table_unref);
|
||||
}
|
||||
|
||||
nm_dhcp_client_set_state (self, new_state, ip_config, str_options);
|
||||
|
@ -1102,9 +1102,9 @@ dispose (GObject *object)
|
|||
nm_clear_g_free (&priv->iface);
|
||||
nm_clear_g_free (&priv->hostname);
|
||||
nm_clear_g_free (&priv->uuid);
|
||||
g_clear_pointer (&priv->client_id, g_bytes_unref);
|
||||
g_clear_pointer (&priv->hwaddr, g_bytes_unref);
|
||||
g_clear_pointer (&priv->bcast_hwaddr, g_bytes_unref);
|
||||
nm_clear_pointer (&priv->client_id, g_bytes_unref);
|
||||
nm_clear_pointer (&priv->hwaddr, g_bytes_unref);
|
||||
nm_clear_pointer (&priv->bcast_hwaddr, g_bytes_unref);
|
||||
|
||||
G_OBJECT_CLASS (nm_dhcp_client_parent_class)->dispose (object);
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
|
|||
|
||||
/* Otherwise capture and return the existing client id */
|
||||
if (out_new_client_id)
|
||||
g_clear_pointer (out_new_client_id, g_bytes_unref);
|
||||
nm_clear_pointer (out_new_client_id, g_bytes_unref);
|
||||
NM_SET_OUT (out_new_client_id, read_client_id (p));
|
||||
}
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ dispose (GObject *object)
|
|||
nm_clear_g_signal_handler (priv->dbus_mgr, &priv->new_conn_id);
|
||||
nm_clear_g_signal_handler (priv->dbus_mgr, &priv->dis_conn_id);
|
||||
|
||||
g_clear_pointer (&priv->connections, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->connections, g_hash_table_destroy);
|
||||
|
||||
g_clear_object (&priv->dbus_mgr);
|
||||
|
||||
|
|
|
@ -1161,7 +1161,7 @@ dispose (GObject *object)
|
|||
|
||||
_main_cleanup (self, FALSE);
|
||||
|
||||
g_clear_pointer (&priv->set_server_ex_args, g_variant_unref);
|
||||
nm_clear_pointer (&priv->set_server_ex_args, g_variant_unref);
|
||||
|
||||
G_OBJECT_CLASS (nm_dns_dnsmasq_parent_class)->dispose (object);
|
||||
|
||||
|
|
|
@ -1368,7 +1368,7 @@ clear_domain_lists (NMDnsManager *self)
|
|||
head = _ip_config_lst_head (self);
|
||||
c_list_for_each_entry (ip_data, head, ip_config_lst) {
|
||||
nm_clear_g_free (&ip_data->domains.search);
|
||||
g_clear_pointer (&ip_data->domains.reverse, g_strfreev);
|
||||
nm_clear_pointer (&ip_data->domains.reverse, g_strfreev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ plugin_skip:
|
|||
&& result == SR_SUCCESS)
|
||||
g_signal_emit (self, signals[CONFIG_CHANGED], 0);
|
||||
|
||||
g_clear_pointer (&priv->config_variant, g_variant_unref);
|
||||
nm_clear_pointer (&priv->config_variant, g_variant_unref);
|
||||
_notify (self, PROP_CONFIGURATION);
|
||||
|
||||
if (result != SR_SUCCESS) {
|
||||
|
@ -2313,7 +2313,7 @@ dispose (GObject *object)
|
|||
c_list_for_each_entry_safe (ip_data, ip_data_safe, &priv->ip_config_lst_head, ip_config_lst)
|
||||
_ip_config_data_free (ip_data);
|
||||
|
||||
g_clear_pointer (&priv->configs, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->configs, g_hash_table_destroy);
|
||||
|
||||
nm_clear_g_source (&priv->plugin_ratelimit.timer);
|
||||
|
||||
|
@ -2321,7 +2321,7 @@ dispose (GObject *object)
|
|||
|
||||
G_OBJECT_CLASS (nm_dns_manager_parent_class)->dispose (object);
|
||||
|
||||
g_clear_pointer (&priv->config_variant, g_variant_unref);
|
||||
nm_clear_pointer (&priv->config_variant, g_variant_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -363,7 +363,7 @@ nmi_dt_reader_parse (const char *sysfs_dir)
|
|||
if (!nm_connection_normalize (connection, NULL, NULL, &error)) {
|
||||
_LOGW (LOGD_CORE, "Generated an invalid connection: %s",
|
||||
error->message);
|
||||
g_clear_pointer (&connection, g_object_unref);
|
||||
nm_clear_pointer (&connection, g_object_unref);
|
||||
}
|
||||
|
||||
return g_steal_pointer (&connection);
|
||||
|
|
|
@ -723,8 +723,8 @@ dispose (GObject *object)
|
|||
|
||||
nm_assert (c_list_is_empty (&self->checkpoints_lst));
|
||||
|
||||
g_clear_pointer (&priv->devices, g_hash_table_unref);
|
||||
g_clear_pointer (&priv->connection_uuids, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->devices, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->connection_uuids, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->removed_devices, g_ptr_array_unref);
|
||||
|
||||
nm_clear_g_signal_handler (priv->manager, &priv->dev_removed_id);
|
||||
|
|
|
@ -274,7 +274,7 @@ nm_config_get_warnings (NMConfig *config)
|
|||
void
|
||||
nm_config_clear_warnings (NMConfig *config)
|
||||
{
|
||||
g_clear_pointer (&NM_CONFIG_GET_PRIVATE (config)->warnings, g_strfreev);
|
||||
nm_clear_pointer (&NM_CONFIG_GET_PRIVATE (config)->warnings, g_strfreev);
|
||||
}
|
||||
|
||||
NMConfigData *
|
||||
|
|
|
@ -1631,7 +1631,7 @@ dispose (GObject *object)
|
|||
nm_assert (!priv->objects_by_path || g_hash_table_size (priv->objects_by_path) == 0);
|
||||
nm_assert (c_list_is_empty (&priv->objects_lst_head));
|
||||
|
||||
g_clear_pointer (&priv->objects_by_path, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->objects_by_path, g_hash_table_destroy);
|
||||
|
||||
c_list_for_each_entry_safe (s, s_safe, &priv->private_servers_lst_head, private_servers_lst)
|
||||
private_server_free (s);
|
||||
|
|
|
@ -596,7 +596,7 @@ main (int argc, char *argv[])
|
|||
_LOGI (LOGD_CORE, "exiting");
|
||||
|
||||
nm_clear_g_source (&sd_id);
|
||||
g_clear_pointer (&gl.main_loop, g_main_loop_unref);
|
||||
nm_clear_pointer (&gl.main_loop, g_main_loop_unref);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7731,7 +7731,7 @@ dispose (GObject *object)
|
|||
|
||||
nm_clear_g_source (&priv->devices_inited_id);
|
||||
|
||||
g_clear_pointer (&priv->checkpoint_mgr, nm_checkpoint_manager_free);
|
||||
nm_clear_pointer (&priv->checkpoint_mgr, nm_checkpoint_manager_free);
|
||||
|
||||
if (priv->concheck_mgr) {
|
||||
g_signal_handlers_disconnect_by_func (priv->concheck_mgr,
|
||||
|
@ -7786,7 +7786,7 @@ dispose (GObject *object)
|
|||
g_clear_object (&priv->vpn_manager);
|
||||
|
||||
sleep_devices_clear (self);
|
||||
g_clear_pointer (&priv->sleep_devices, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->sleep_devices, g_hash_table_unref);
|
||||
|
||||
if (priv->sleep_monitor) {
|
||||
g_signal_handlers_disconnect_by_func (priv->sleep_monitor, sleeping_cb, self);
|
||||
|
@ -7816,7 +7816,7 @@ dispose (GObject *object)
|
|||
|
||||
nm_clear_g_source (&priv->timestamp_update_id);
|
||||
|
||||
g_clear_pointer (&priv->device_route_metrics, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->device_route_metrics, g_hash_table_destroy);
|
||||
|
||||
G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object);
|
||||
}
|
||||
|
|
|
@ -2668,7 +2668,7 @@ dispose (GObject *object)
|
|||
nm_clear_g_object (&priv->default_ac6);
|
||||
nm_clear_g_object (&priv->activating_ac4);
|
||||
nm_clear_g_object (&priv->activating_ac6);
|
||||
g_clear_pointer (&priv->pending_active_connections, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->pending_active_connections, g_hash_table_unref);
|
||||
|
||||
c_list_for_each_entry_safe (data, data_safe, &priv->pending_activation_checks, pending_lst)
|
||||
activate_data_free (data);
|
||||
|
|
|
@ -185,8 +185,8 @@ out:
|
|||
if (error)
|
||||
_LOGE ("failed to load ConsoleKit database: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
g_clear_pointer (&groups, g_strfreev);
|
||||
g_clear_pointer (&keyfile, g_key_file_free);
|
||||
nm_clear_pointer (&groups, g_strfreev);
|
||||
nm_clear_pointer (&keyfile, g_key_file_free);
|
||||
|
||||
return finished;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ ck_init (NMSessionMonitor *monitor)
|
|||
static void
|
||||
ck_finalize (NMSessionMonitor *monitor)
|
||||
{
|
||||
g_clear_pointer (&monitor->ck.cache, g_hash_table_unref);
|
||||
nm_clear_pointer (&monitor->ck.cache, g_hash_table_unref);
|
||||
g_clear_object (&monitor->ck.monitor);
|
||||
}
|
||||
#endif /* SESSION_TRACKING_CONSOLEKIT */
|
||||
|
|
|
@ -1346,7 +1346,7 @@ finalize (GObject *object)
|
|||
NMFakePlatformLink *device = &g_array_index (priv->links, NMFakePlatformLink, i);
|
||||
|
||||
g_free (device->udi);
|
||||
g_clear_pointer (&device->obj, nmp_object_unref);
|
||||
nm_clear_pointer (&device->obj, nmp_object_unref);
|
||||
}
|
||||
g_array_unref (priv->links);
|
||||
|
||||
|
|
|
@ -8351,7 +8351,7 @@ ip_route_get (NMPlatform *platform,
|
|||
.r.rtm_flags = 0x1000 /* RTM_F_LOOKUP_TABLE */,
|
||||
};
|
||||
|
||||
g_clear_pointer (&route, nmp_object_unref);
|
||||
nm_clear_pointer (&route, nmp_object_unref);
|
||||
|
||||
if (!_nl_addattr_l (&req.n, sizeof (req), RTA_DST, address, addr_len))
|
||||
nm_assert_not_reached ();
|
||||
|
@ -8554,7 +8554,7 @@ event_handler_recvmsgs (NMPlatform *platform, gboolean handle_events)
|
|||
nm_auto_free unsigned char *buf = NULL;
|
||||
|
||||
continue_reading:
|
||||
g_clear_pointer (&buf, free);
|
||||
nm_clear_pointer (&buf, free);
|
||||
n = nl_recv (sk, &nla, &buf, &creds, &creds_has);
|
||||
|
||||
if (n <= 0) {
|
||||
|
|
|
@ -4761,7 +4761,7 @@ _ip4_dev_route_blacklist_schedule (NMPlatform *self)
|
|||
|
||||
if ( !priv->ip4_dev_route_blacklist_hash
|
||||
|| g_hash_table_size (priv->ip4_dev_route_blacklist_hash) == 0) {
|
||||
g_clear_pointer (&priv->ip4_dev_route_blacklist_hash, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->ip4_dev_route_blacklist_hash, g_hash_table_unref);
|
||||
nm_clear_g_source (&priv->ip4_dev_route_blacklist_gc_timeout_id);
|
||||
} else {
|
||||
if (!priv->ip4_dev_route_blacklist_gc_timeout_id) {
|
||||
|
@ -7943,7 +7943,7 @@ finalize (GObject *object)
|
|||
|
||||
nm_clear_g_source (&priv->ip4_dev_route_blacklist_check_id);
|
||||
nm_clear_g_source (&priv->ip4_dev_route_blacklist_gc_timeout_id);
|
||||
g_clear_pointer (&priv->ip4_dev_route_blacklist_hash, g_hash_table_unref);
|
||||
nm_clear_pointer (&priv->ip4_dev_route_blacklist_hash, g_hash_table_unref);
|
||||
g_clear_object (&self->_netns);
|
||||
nm_dedup_multi_index_unref (priv->multi_idx);
|
||||
nmp_cache_free (priv->cache);
|
||||
|
|
|
@ -190,7 +190,7 @@ _accept_or_wait_signal (const char *file, int line, const char *func, SignalData
|
|||
if (data->received_count == 0) {
|
||||
data->loop = g_main_loop_new (NULL, FALSE);
|
||||
g_main_loop_run (data->loop);
|
||||
g_clear_pointer (&data->loop, g_main_loop_unref);
|
||||
nm_clear_pointer (&data->loop, g_main_loop_unref);
|
||||
}
|
||||
|
||||
_accept_signal (file, line, func, data);
|
||||
|
@ -205,7 +205,7 @@ _wait_signal (const char *file, int line, const char *func, SignalData *data)
|
|||
|
||||
data->loop = g_main_loop_new (NULL, FALSE);
|
||||
g_main_loop_run (data->loop);
|
||||
g_clear_pointer (&data->loop, g_main_loop_unref);
|
||||
nm_clear_pointer (&data->loop, g_main_loop_unref);
|
||||
|
||||
_accept_signal (file, line, func, data);
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ nmtstp_wait_for_signal (NMPlatform *platform, gint64 timeout_msec)
|
|||
g_assert (nm_clear_g_signal_handler (platform, &id_ip4_route));
|
||||
g_assert (nm_clear_g_signal_handler (platform, &id_ip6_route));
|
||||
|
||||
g_clear_pointer (&data.loop, g_main_loop_unref);
|
||||
nm_clear_pointer (&data.loop, g_main_loop_unref);
|
||||
|
||||
/* return the number of signals, or 0 if timeout was reached .*/
|
||||
return data.signal_counts;
|
||||
|
|
|
@ -2611,14 +2611,14 @@ dispose (GObject *object)
|
|||
nm_clear_pointer (&priv->system_secrets, g_variant_unref);
|
||||
nm_clear_pointer (&priv->agent_secrets, g_variant_unref);
|
||||
|
||||
g_clear_pointer (&priv->seen_bssids, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->seen_bssids, g_hash_table_destroy);
|
||||
|
||||
g_clear_object (&priv->agent_mgr);
|
||||
|
||||
g_clear_object (&priv->connection);
|
||||
|
||||
g_clear_pointer (&priv->kf_db_timestamps, nm_key_file_db_unref);
|
||||
g_clear_pointer (&priv->kf_db_seen_bssids, nm_key_file_db_unref);
|
||||
nm_clear_pointer (&priv->kf_db_timestamps, nm_key_file_db_unref);
|
||||
nm_clear_pointer (&priv->kf_db_seen_bssids, nm_key_file_db_unref);
|
||||
|
||||
G_OBJECT_CLASS (nm_settings_connection_parent_class)->dispose (object);
|
||||
|
||||
|
|
|
@ -1338,7 +1338,7 @@ read_one_ip4_route (shvarFile *ifcfg,
|
|||
v = svGetValueStr (ifcfg, numbered_tag (tag, "OPTIONS", which), &value);
|
||||
if (v) {
|
||||
if (parse_route_line (v, AF_INET, *out_route, NULL, error) < 0) {
|
||||
g_clear_pointer (out_route, nm_ip_route_unref);
|
||||
nm_clear_pointer (out_route, nm_ip_route_unref);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ dispose (GObject *object)
|
|||
NMSIfupdownPlugin *plugin = NMS_IFUPDOWN_PLUGIN (object);
|
||||
NMSIfupdownPluginPrivate *priv = NMS_IFUPDOWN_PLUGIN_GET_PRIVATE (plugin);
|
||||
|
||||
g_clear_pointer (&priv->eni_ifaces, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->eni_ifaces, g_hash_table_destroy);
|
||||
|
||||
G_OBJECT_CLASS (nms_ifupdown_plugin_parent_class)->dispose (object);
|
||||
}
|
||||
|
|
|
@ -3174,8 +3174,8 @@ dispose (GObject *object)
|
|||
|
||||
nm_assert (!priv->assoc_data);
|
||||
|
||||
g_clear_pointer (&priv->bss_idx, g_hash_table_destroy);
|
||||
g_clear_pointer (&priv->peer_idx, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->bss_idx, g_hash_table_destroy);
|
||||
nm_clear_pointer (&priv->peer_idx, g_hash_table_destroy);
|
||||
|
||||
nm_clear_pointer (&priv->current_bss, nm_ref_string_unref);
|
||||
|
||||
|
|
|
@ -1636,7 +1636,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
nm_ip4_config_add_route (config, &r, NULL);
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->ip4_dev_route_blacklist, g_ptr_array_unref);
|
||||
nm_clear_pointer (&priv->ip4_dev_route_blacklist, g_ptr_array_unref);
|
||||
|
||||
nm_ip4_config_add_dependent_routes (config,
|
||||
route_table,
|
||||
|
@ -1883,7 +1883,7 @@ connect_success (NMVpnConnection *self)
|
|||
}
|
||||
priv->connect_timeout = g_timeout_add_seconds (timeout, connect_timeout_cb, self);
|
||||
|
||||
g_clear_pointer (&priv->connect_hash, g_variant_unref);
|
||||
nm_clear_pointer (&priv->connect_hash, g_variant_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1980,7 +1980,7 @@ really_activate (NMVpnConnection *self, const char *username)
|
|||
priv = NM_VPN_CONNECTION_GET_PRIVATE (self);
|
||||
g_return_if_fail (priv->vpn_state == STATE_NEED_AUTH);
|
||||
|
||||
g_clear_pointer (&priv->connect_hash, g_variant_unref);
|
||||
nm_clear_pointer (&priv->connect_hash, g_variant_unref);
|
||||
priv->connect_hash = _hash_with_username (_get_applied_connection (self), username);
|
||||
g_variant_ref_sink (priv->connect_hash);
|
||||
|
||||
|
@ -2764,9 +2764,9 @@ dispose (GObject *object)
|
|||
|
||||
nm_clear_g_source (&priv->start_timeout);
|
||||
|
||||
g_clear_pointer (&priv->connect_hash, g_variant_unref);
|
||||
nm_clear_pointer (&priv->connect_hash, g_variant_unref);
|
||||
|
||||
g_clear_pointer (&priv->ip4_dev_route_blacklist, g_ptr_array_unref);
|
||||
nm_clear_pointer (&priv->ip4_dev_route_blacklist, g_ptr_array_unref);
|
||||
|
||||
nm_clear_g_source (&priv->connect_timeout);
|
||||
|
||||
|
|
Loading…
Reference in a new issue