Commit 936c6d0b authored by Thomas Haller's avatar Thomas Haller

core: add nm_manager_for_each_active_connection_safe() and nm_manager_for_each_device_safe()

Analog to c_list_for_each_safe(), which allows to delete the current instance
while iterating. Note that modifying the list any other way is unsafe.
parent c9354cb4
......@@ -97,6 +97,19 @@ const CList * nm_manager_get_active_connections (NMManager *manager);
}); \
iter = c_list_entry (iter->active_connections_lst.next, NMActiveConnection, active_connections_lst))
#define nm_manager_for_each_active_connection_safe(manager, iter, tmp_list, iter_safe) \
for (tmp_list = nm_manager_get_active_connections (manager), \
iter_safe = tmp_list->next; \
({ \
if (iter_safe != tmp_list) { \
iter = c_list_entry (iter_safe, NMActiveConnection, active_connections_lst); \
iter_safe = iter_safe->next; \
} else \
iter = NULL; \
(iter != NULL); \
}); \
)
NMSettingsConnection **nm_manager_get_activatable_connections (NMManager *manager,
gboolean for_auto_activation,
gboolean sort,
......@@ -121,6 +134,19 @@ const CList * nm_manager_get_devices (NMManager *manager);
}); \
iter = c_list_entry (iter->devices_lst.next, NMDevice, devices_lst))
#define nm_manager_for_each_device_safe(manager, iter, tmp_list, iter_safe) \
for (tmp_list = nm_manager_get_devices (manager), \
iter_safe = tmp_list->next; \
({ \
if (iter_safe != tmp_list) { \
iter = c_list_entry (iter_safe, NMDevice, devices_lst); \
iter_safe = iter_safe->next; \
} else \
iter = NULL; \
(iter != NULL); \
}); \
)
NMDevice * nm_manager_get_device_by_ifindex (NMManager *manager,
int ifindex);
NMDevice * nm_manager_get_device_by_path (NMManager *manager,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment