mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 15:00:35 +01:00
all: use _nm_utils_hash_values_to_slist()
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
ff142ce780
commit
e478d1fb71
4 changed files with 12 additions and 33 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include <nm-setting-vpn.h>
|
||||
#include <nm-setting-wireless.h>
|
||||
#include <nm-utils.h>
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "nm-settings-connection.h"
|
||||
#include "nm-session-monitor.h"
|
||||
|
|
@ -1162,7 +1163,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);
|
||||
g_slist_free_full (bssid_list, g_free);
|
||||
g_slist_free (bssid_list);
|
||||
|
||||
/* 802-11-wireless.security property is deprecated. But we set it here so that
|
||||
* we don't disturb old clients that might expect it being properly set for
|
||||
|
|
@ -1745,24 +1746,15 @@ mac_dup (const guint8 *old)
|
|||
*
|
||||
* Returns current list of seen BSSIDs for the connection.
|
||||
*
|
||||
* Returns: (transfer full) list of seen BSSIDs (in the standard hex-digits-and-colons notation).
|
||||
* The caller is responsible for freeing the list.
|
||||
* Returns: (transfer container) list of seen BSSIDs (in the standard hex-digits-and-colons notation).
|
||||
* The caller is responsible for freeing the list, but not the content.
|
||||
**/
|
||||
GSList *
|
||||
nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection)
|
||||
{
|
||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
|
||||
GHashTableIter iter;
|
||||
char *bssid_str;
|
||||
GSList *bssid_list = NULL;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), NULL);
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->seen_bssids);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &bssid_str))
|
||||
bssid_list = g_slist_prepend (bssid_list, g_strdup (bssid_str));
|
||||
|
||||
return bssid_list;
|
||||
return _nm_utils_hash_values_to_slist (NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->seen_bssids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
#include <nm-setting-wireless-security.h>
|
||||
#include <nm-setting-bond.h>
|
||||
#include <nm-utils.h>
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "nm-device-ethernet.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
|
|
@ -1763,13 +1764,8 @@ get_connections (NMConnectionProvider *provider)
|
|||
GSList *list = NULL;
|
||||
NMSettings *self = NM_SETTINGS (provider);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GHashTableIter iter;
|
||||
NMSettingsConnection *connection;
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->connections);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &connection))
|
||||
list = g_slist_prepend (list, connection);
|
||||
list = g_slist_reverse (list);
|
||||
list = _nm_utils_hash_values_to_slist (priv->connections);
|
||||
|
||||
/* Cache the list every call so we can keep it 'const' for callers */
|
||||
g_slist_free (priv->get_connections_cache);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "nm-setting-wired.h"
|
||||
#include "nm-setting-ppp.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "nm-ifupdown-connection.h"
|
||||
#include "plugin.h"
|
||||
|
|
@ -505,9 +506,7 @@ static GSList*
|
|||
SCPluginIfupdown_get_connections (NMSystemConfigInterface *config)
|
||||
{
|
||||
SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (config);
|
||||
GSList *connections = NULL;
|
||||
GHashTableIter iter;
|
||||
gpointer value;
|
||||
GSList *connections;
|
||||
|
||||
nm_log_info (LOGD_SETTINGS, "(%d) ... get_connections.", GPOINTER_TO_UINT(config));
|
||||
|
||||
|
|
@ -516,9 +515,7 @@ SCPluginIfupdown_get_connections (NMSystemConfigInterface *config)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->connections);
|
||||
while (g_hash_table_iter_next (&iter, NULL, &value))
|
||||
connections = g_slist_prepend (connections, value);
|
||||
connections = _nm_utils_hash_values_to_slist (priv->connections);
|
||||
|
||||
nm_log_info (LOGD_SETTINGS, "(%d) connections count: %d", GPOINTER_TO_UINT(config), g_slist_length(connections));
|
||||
return connections;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <nm-utils.h>
|
||||
#include <nm-config.h>
|
||||
#include <nm-logging.h>
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "plugin.h"
|
||||
#include "nm-system-config-interface.h"
|
||||
|
|
@ -372,20 +373,13 @@ static GSList *
|
|||
get_connections (NMSystemConfigInterface *config)
|
||||
{
|
||||
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config);
|
||||
GHashTableIter iter;
|
||||
gpointer data = NULL;
|
||||
GSList *list = NULL;
|
||||
|
||||
if (!priv->initialized) {
|
||||
setup_monitoring (config);
|
||||
read_connections (config);
|
||||
priv->initialized = TRUE;
|
||||
}
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->connections);
|
||||
while (g_hash_table_iter_next (&iter, NULL, &data))
|
||||
list = g_slist_prepend (list, data);
|
||||
return list;
|
||||
return _nm_utils_hash_values_to_slist (priv->connections);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue