summaryrefslogtreecommitdiff
path: root/src/nm-checkpoint.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-23 21:30:09 +0100
committerThomas Haller <thaller@redhat.com>2017-11-27 14:04:11 +0100
commit3a907377ac360325e8dea3f5ff864ce55a4950c1 (patch)
tree0a2d8cdd767fc9eb04600121d8aa40bbb7d0e2f1 /src/nm-checkpoint.c
parent51531c953972215e0b15900463378fb8524b4232 (diff)
downloadNetworkManager-3a907377ac360325e8dea3f5ff864ce55a4950c1.tar.gz
core: track NMActiveConnection in manager with CList
Using CList, we embed the list element in NMActiveConnection struct itself. That means for example, that you couldn't track a NMActiveConnection more then once. But we anyway never want that. The advantage is, that removing an active connection from the list is O(1), and we safe additional GSlice allocations for each node element.
Diffstat (limited to 'src/nm-checkpoint.c')
-rw-r--r--src/nm-checkpoint.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nm-checkpoint.c b/src/nm-checkpoint.c
index 0390255ddc..af56bf26e6 100644
--- a/src/nm-checkpoint.c
+++ b/src/nm-checkpoint.c
@@ -125,10 +125,10 @@ find_settings_connection (NMCheckpoint *self,
gboolean *need_activation)
{
NMCheckpointPrivate *priv = NM_CHECKPOINT_GET_PRIVATE (self);
- const GSList *active_connections, *iter;
- NMActiveConnection *active = NULL;
+ NMActiveConnection *active;
NMSettingsConnection *connection;
const char *uuid, *ac_uuid;
+ const CList *tmp_clist;
*need_activation = FALSE;
*need_update = FALSE;
@@ -149,9 +149,7 @@ find_settings_connection (NMCheckpoint *self,
}
/* ... is active, ... */
- active_connections = nm_manager_get_active_connections (priv->manager);
- for (iter = active_connections; iter; iter = g_slist_next (iter)) {
- active = iter->data;
+ nm_manager_for_each_active_connection (priv->manager, active, tmp_clist) {
ac_uuid = nm_settings_connection_get_uuid (nm_active_connection_get_settings_connection (active));
if (nm_streq (uuid, ac_uuid)) {
_LOGT ("rollback: connection %s is active", uuid);
@@ -159,7 +157,7 @@ find_settings_connection (NMCheckpoint *self,
}
}
- if (!iter) {
+ if (!active) {
_LOGT ("rollback: connection %s is not active", uuid);
*need_activation = TRUE;
return connection;