libnm-util: deprecate nm_utils_slist_free(), use g_slist_free_full()

This commit is contained in:
Dan Winship 2013-05-29 17:11:44 -03:00
parent c7c8655832
commit 43617d4c1d
14 changed files with 63 additions and 67 deletions

View file

@ -290,7 +290,7 @@ nm_setting_802_1x_clear_eap_methods (NMSetting8021x *setting)
g_return_if_fail (NM_IS_SETTING_802_1X (setting));
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
nm_utils_slist_free (priv->eap, g_free);
g_slist_free_full (priv->eap, g_free);
priv->eap = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_EAP);
}
@ -695,7 +695,7 @@ nm_setting_802_1x_clear_altsubject_matches (NMSetting8021x *setting)
g_return_if_fail (NM_IS_SETTING_802_1X (setting));
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
nm_utils_slist_free (priv->altsubject_matches, g_free);
g_slist_free_full (priv->altsubject_matches, g_free);
priv->altsubject_matches = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
}
@ -1242,7 +1242,7 @@ nm_setting_802_1x_clear_phase2_altsubject_matches (NMSetting8021x *setting)
g_return_if_fail (NM_IS_SETTING_802_1X (setting));
priv = NM_SETTING_802_1X_GET_PRIVATE (setting);
nm_utils_slist_free (priv->phase2_altsubject_matches, g_free);
g_slist_free_full (priv->phase2_altsubject_matches, g_free);
priv->phase2_altsubject_matches = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
}
@ -2665,9 +2665,9 @@ finalize (GObject *object)
g_byte_array_free (priv->password_raw, TRUE);
g_free (priv->pin);
nm_utils_slist_free (priv->eap, g_free);
nm_utils_slist_free (priv->altsubject_matches, g_free);
nm_utils_slist_free (priv->phase2_altsubject_matches, g_free);
g_slist_free_full (priv->eap, g_free);
g_slist_free_full (priv->altsubject_matches, g_free);
g_slist_free_full (priv->phase2_altsubject_matches, g_free);
if (priv->ca_cert)
g_byte_array_free (priv->ca_cert, TRUE);
@ -2715,7 +2715,7 @@ set_property (GObject *object, guint prop_id,
switch (prop_id) {
case PROP_EAP:
nm_utils_slist_free (priv->eap, g_free);
g_slist_free_full (priv->eap, g_free);
priv->eap = g_value_dup_boxed (value);
break;
case PROP_IDENTITY:
@ -2751,7 +2751,7 @@ set_property (GObject *object, guint prop_id,
priv->subject_match = g_value_dup_string (value);
break;
case PROP_ALTSUBJECT_MATCHES:
nm_utils_slist_free (priv->altsubject_matches, g_free);
g_slist_free_full (priv->altsubject_matches, g_free);
priv->altsubject_matches = g_value_dup_boxed (value);
break;
case PROP_CLIENT_CERT:
@ -2807,7 +2807,7 @@ set_property (GObject *object, guint prop_id,
priv->phase2_subject_match = g_value_dup_string (value);
break;
case PROP_PHASE2_ALTSUBJECT_MATCHES:
nm_utils_slist_free (priv->phase2_altsubject_matches, g_free);
g_slist_free_full (priv->phase2_altsubject_matches, g_free);
priv->phase2_altsubject_matches = g_value_dup_boxed (value);
break;
case PROP_PHASE2_CLIENT_CERT:

View file

@ -845,7 +845,7 @@ finalize (GObject *object)
g_free (priv->zone);
g_free (priv->master);
g_free (priv->slave_type);
nm_utils_slist_free (priv->permissions, (GDestroyNotify) permission_free);
g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free);
G_OBJECT_CLASS (nm_setting_connection_parent_class)->finalize (object);
}
@ -890,7 +890,7 @@ set_property (GObject *object, guint prop_id,
priv->type = g_value_dup_string (value);
break;
case PROP_PERMISSIONS:
nm_utils_slist_free (priv->permissions, (GDestroyNotify) permission_free);
g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free);
priv->permissions = perm_stringlist_to_permlist (g_value_get_boxed (value));
break;
case PROP_AUTOCONNECT:
@ -915,7 +915,7 @@ set_property (GObject *object, guint prop_id,
priv->slave_type = g_value_dup_string (value);
break;
case PROP_SECONDARIES:
nm_utils_slist_free (priv->secondaries, g_free);
g_slist_free_full (priv->secondaries, g_free);
priv->secondaries = g_value_dup_boxed (value);
break;
default:

View file

@ -337,7 +337,7 @@ nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting)
{
g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
nm_utils_slist_free (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
g_slist_free_full (NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_DNS_SEARCH);
}
@ -449,7 +449,7 @@ nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting)
g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
priv->addresses = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES);
}
@ -560,7 +560,7 @@ nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting)
g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting));
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
priv->routes = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
}
@ -855,9 +855,9 @@ finalize (GObject *object)
g_array_free (priv->dns, TRUE);
nm_utils_slist_free (priv->dns_search, g_free);
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
g_slist_free_full (priv->dns_search, g_free);
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
G_OBJECT_CLASS (nm_setting_ip4_config_parent_class)->finalize (object);
}
@ -881,15 +881,15 @@ set_property (GObject *object, guint prop_id,
priv->dns = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3);
break;
case PROP_DNS_SEARCH:
nm_utils_slist_free (priv->dns_search, g_free);
g_slist_free_full (priv->dns_search, g_free);
priv->dns_search = g_value_dup_boxed (value);
break;
case PROP_ADDRESSES:
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
priv->addresses = nm_utils_ip4_addresses_from_gvalue (value);
break;
case PROP_ROUTES:
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
priv->routes = nm_utils_ip4_routes_from_gvalue (value);
break;
case PROP_IGNORE_AUTO_ROUTES:

View file

@ -252,7 +252,7 @@ nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting)
{
g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
nm_utils_slist_free (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns, g_free);
g_slist_free_full (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns, g_free);
NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS);
}
@ -358,7 +358,7 @@ nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting)
{
g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
nm_utils_slist_free (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
g_slist_free_full (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search, g_free);
NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_DNS_SEARCH);
}
@ -470,7 +470,7 @@ nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting)
g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
priv->addresses = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
}
@ -581,7 +581,7 @@ nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting)
g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting));
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
priv->routes = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
}
@ -772,9 +772,9 @@ finalize (GObject *object)
g_slist_free (priv->dns);
nm_utils_slist_free (priv->dns_search, g_free);
nm_utils_slist_free (priv->addresses, g_free);
nm_utils_slist_free (priv->routes, g_free);
g_slist_free_full (priv->dns_search, g_free);
g_slist_free_full (priv->addresses, g_free);
g_slist_free_full (priv->routes, g_free);
G_OBJECT_CLASS (nm_setting_ip6_config_parent_class)->finalize (object);
}
@ -791,19 +791,19 @@ set_property (GObject *object, guint prop_id,
priv->method = g_value_dup_string (value);
break;
case PROP_DNS:
nm_utils_slist_free (priv->dns, g_free);
g_slist_free_full (priv->dns, g_free);
priv->dns = nm_utils_ip6_dns_from_gvalue (value);
break;
case PROP_DNS_SEARCH:
nm_utils_slist_free (priv->dns_search, g_free);
g_slist_free_full (priv->dns_search, g_free);
priv->dns_search = g_value_dup_boxed (value);
break;
case PROP_ADDRESSES:
nm_utils_slist_free (priv->addresses, g_free);
g_slist_free_full (priv->addresses, g_free);
priv->addresses = nm_utils_ip6_addresses_from_gvalue (value);
break;
case PROP_ROUTES:
nm_utils_slist_free (priv->routes, g_free);
g_slist_free_full (priv->routes, g_free);
priv->routes = nm_utils_ip6_routes_from_gvalue (value);
break;
case PROP_IGNORE_AUTO_ROUTES:

View file

@ -440,7 +440,7 @@ nm_setting_vlan_clear_priorities (NMSettingVlan *setting, NMVlanPriorityMap map)
g_return_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP);
list = get_map (setting, map);
nm_utils_slist_free (list, g_free);
g_slist_free_full (list, g_free);
set_map (setting, map, NULL);
}
@ -586,12 +586,12 @@ set_property (GObject *object, guint prop_id,
priv->flags = g_value_get_uint (value);
break;
case PROP_INGRESS_PRIORITY_MAP:
nm_utils_slist_free (priv->ingress_priority_map, g_free);
g_slist_free_full (priv->ingress_priority_map, g_free);
priv->ingress_priority_map =
priority_stringlist_to_maplist (NM_VLAN_INGRESS_MAP, g_value_get_boxed (value));
break;
case PROP_EGRESS_PRIORITY_MAP:
nm_utils_slist_free (priv->egress_priority_map, g_free);
g_slist_free_full (priv->egress_priority_map, g_free);
priv->egress_priority_map =
priority_stringlist_to_maplist (NM_VLAN_EGRESS_MAP, g_value_get_boxed (value));
break;
@ -654,8 +654,8 @@ finalize (GObject *object)
g_free (priv->iface_name);
g_free (priv->parent);
nm_utils_slist_free (priv->ingress_priority_map, g_free);
nm_utils_slist_free (priv->egress_priority_map, g_free);
g_slist_free_full (priv->ingress_priority_map, g_free);
g_slist_free_full (priv->egress_priority_map, g_free);
}
static void

View file

@ -671,7 +671,7 @@ finalize (GObject *object)
if (priv->cloned_mac_address)
g_byte_array_free (priv->cloned_mac_address, TRUE);
nm_utils_slist_free (priv->mac_address_blacklist, g_free);
g_slist_free_full (priv->mac_address_blacklist, g_free);
if (priv->s390_subchannels) {
g_ptr_array_foreach (priv->s390_subchannels, (GFunc) g_free, NULL);
@ -720,7 +720,7 @@ set_property (GObject *object, guint prop_id,
priv->cloned_mac_address = g_value_dup_boxed (value);
break;
case PROP_MAC_ADDRESS_BLACKLIST:
nm_utils_slist_free (priv->mac_address_blacklist, g_free);
g_slist_free_full (priv->mac_address_blacklist, g_free);
priv->mac_address_blacklist = g_value_dup_boxed (value);
break;
case PROP_MTU:

View file

@ -271,7 +271,7 @@ nm_setting_wireless_security_clear_protos (NMSettingWirelessSecurity *setting)
g_return_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting));
priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting);
nm_utils_slist_free (priv->proto, g_free);
g_slist_free_full (priv->proto, g_free);
priv->proto = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PROTO);
}
@ -386,7 +386,7 @@ nm_setting_wireless_security_clear_pairwise (NMSettingWirelessSecurity *setting)
g_return_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting));
priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting);
nm_utils_slist_free (priv->pairwise, g_free);
g_slist_free_full (priv->pairwise, g_free);
priv->pairwise = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
}
@ -502,7 +502,7 @@ nm_setting_wireless_security_clear_groups (NMSettingWirelessSecurity *setting)
g_return_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting));
priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting);
nm_utils_slist_free (priv->group, g_free);
g_slist_free_full (priv->group, g_free);
priv->group = NULL;
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SECURITY_GROUP);
}
@ -1085,9 +1085,9 @@ finalize (GObject *object)
g_free (priv->psk);
g_free (priv->leap_password);
nm_utils_slist_free (priv->proto, g_free);
nm_utils_slist_free (priv->pairwise, g_free);
nm_utils_slist_free (priv->group, g_free);
g_slist_free_full (priv->proto, g_free);
g_slist_free_full (priv->pairwise, g_free);
g_slist_free_full (priv->group, g_free);
G_OBJECT_CLASS (nm_setting_wireless_security_parent_class)->finalize (object);
}
@ -1115,15 +1115,15 @@ set_property (GObject *object, guint prop_id,
priv->auth_alg = str ? g_ascii_strdown (str, -1) : NULL;
break;
case PROP_PROTO:
nm_utils_slist_free (priv->proto, g_free);
g_slist_free_full (priv->proto, g_free);
priv->proto = g_value_dup_boxed (value);
break;
case PROP_PAIRWISE:
nm_utils_slist_free (priv->pairwise, g_free);
g_slist_free_full (priv->pairwise, g_free);
priv->pairwise = g_value_dup_boxed (value);
break;
case PROP_GROUP:
nm_utils_slist_free (priv->group, g_free);
g_slist_free_full (priv->group, g_free);
priv->group = g_value_dup_boxed (value);
break;
case PROP_LEAP_USERNAME:

View file

@ -856,8 +856,8 @@ finalize (GObject *object)
g_byte_array_free (priv->device_mac_address, TRUE);
if (priv->cloned_mac_address)
g_byte_array_free (priv->cloned_mac_address, TRUE);
nm_utils_slist_free (priv->mac_address_blacklist, g_free);
nm_utils_slist_free (priv->seen_bssids, g_free);
g_slist_free_full (priv->mac_address_blacklist, g_free);
g_slist_free_full (priv->seen_bssids, g_free);
G_OBJECT_CLASS (nm_setting_wireless_parent_class)->finalize (object);
}
@ -907,14 +907,14 @@ set_property (GObject *object, guint prop_id,
priv->cloned_mac_address = g_value_dup_boxed (value);
break;
case PROP_MAC_ADDRESS_BLACKLIST:
nm_utils_slist_free (priv->mac_address_blacklist, g_free);
g_slist_free_full (priv->mac_address_blacklist, g_free);
priv->mac_address_blacklist = g_value_dup_boxed (value);
break;
case PROP_MTU:
priv->mtu = g_value_get_uint (value);
break;
case PROP_SEEN_BSSIDS:
nm_utils_slist_free (priv->seen_bssids, g_free);
g_slist_free_full (priv->seen_bssids, g_free);
priv->seen_bssids = g_value_dup_boxed (value);
break;
case PROP_SEC:

View file

@ -488,17 +488,13 @@ nm_utils_gvalue_hash_dup (GHashTable *hash)
* @elem_destroy_fn: user function called for each element in @list
*
* Utility function to free a #GSList.
*
* Deprecated: use g_slist_free_full().
**/
void
nm_utils_slist_free (GSList *list, GDestroyNotify elem_destroy_fn)
{
if (!list)
return;
if (elem_destroy_fn)
g_slist_foreach (list, (GFunc) elem_destroy_fn, NULL);
g_slist_free (list);
g_slist_free_full (list, elem_destroy_fn);
}
gboolean

View file

@ -930,8 +930,8 @@ finalize (GObject *object)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
g_array_free (priv->wins, TRUE);
g_array_free (priv->nameservers, TRUE);
g_ptr_array_free (priv->domains, TRUE);

View file

@ -790,8 +790,8 @@ finalize (GObject *object)
{
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
nm_utils_slist_free (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
g_array_free (priv->nameservers, TRUE);
g_ptr_array_free (priv->domains, TRUE);
g_ptr_array_free (priv->searches, TRUE);

View file

@ -1026,7 +1026,7 @@ static void
pending_secondary_data_free (PendingSecondaryData *data)
{
g_object_unref (data->device);
nm_utils_slist_free (data->secondaries, g_free);
g_slist_free_full (data->secondaries, g_free);
memset (data, 0, sizeof (*data));
g_free (data);
}
@ -1294,7 +1294,7 @@ activate_secondary_connections (NMPolicy *policy,
secondary_data = pending_secondary_data_new (device, secondary_ac_list);
policy->pending_secondaries = g_slist_append (policy->pending_secondaries, secondary_data);
} else
nm_utils_slist_free (secondary_ac_list, g_free);
g_slist_free_full (secondary_ac_list, g_free);
return success;
}

View file

@ -1140,7 +1140,7 @@ get_settings_auth_cb (NMSettingsConnection *self,
s_wifi = nm_connection_get_setting_wireless (NM_CONNECTION (dupl_con));
if (bssid_list && s_wifi) {
g_object_set (s_wifi, NM_SETTING_WIRELESS_SEEN_BSSIDS, bssid_list, NULL);
nm_utils_slist_free (bssid_list, g_free);
g_slist_free_full (bssid_list, g_free);
}
/* Secrets should *never* be returned by the GetSettings method, they

View file

@ -1132,7 +1132,7 @@ vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVlanPriorityMap ma
for (iter = strlist; iter; iter = g_slist_next (iter))
g_string_append_printf (value, "%s%s", value->len ? "," : "", (const char *) iter->data);
nm_utils_slist_free (strlist, g_free);
g_slist_free_full (strlist, g_free);
return value;
}