about summary refs log tree commit diff
path: root/shared/nm-utils/nm-c-list.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-03-26 23:26:14 +0100
committerMichael Biebl <biebl@debian.org>2019-03-26 23:26:14 +0100
commit9bc3ff81969c896f6bf8e1c93f98f43f6ffffaf8 (patch)
tree302fce2d1ab3a130ac0b684d168ab6312825fcd2 /shared/nm-utils/nm-c-list.h
parentf97666c6bd29a3228443acd6401a407a19ec8d25 (diff)
parent9a6dcbf895f9da01768e64b73cec88c16157d91e (diff)
Update upstream source from tag 'upstream/1.16.0'
Update to upstream version '1.16.0'
with Debian dir a0f3ffb137940d423625faae8bedbaced4d34cda
Diffstat (limited to 'shared/nm-utils/nm-c-list.h')
-rw-r--r--shared/nm-utils/nm-c-list.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-c-list.h b/shared/nm-utils/nm-c-list.h
index b43d1441..5c73f574 100644
--- a/shared/nm-utils/nm-c-list.h
+++ b/shared/nm-utils/nm-c-list.h
@@ -78,4 +78,40 @@ nm_c_list_elem_free_all (CList *head, GDestroyNotify free_fcn)
 	}
 }
 
+/*****************************************************************************/
+
+static inline gboolean
+nm_c_list_move_before (CList *lst, CList *elem)
+{
+	nm_assert (lst);
+	nm_assert (elem);
+	nm_assert (c_list_contains (lst, elem));
+
+	if (   lst != elem
+	    && lst->prev != elem) {
+		c_list_unlink_stale (elem);
+		c_list_link_before (lst, elem);
+		return TRUE;
+	}
+	return FALSE;
+}
+#define nm_c_list_move_tail(lst, elem) nm_c_list_move_before (lst, elem)
+
+static inline gboolean
+nm_c_list_move_after (CList *lst, CList *elem)
+{
+	nm_assert (lst);
+	nm_assert (elem);
+	nm_assert (c_list_contains (lst, elem));
+
+	if (   lst != elem
+	    && lst->next != elem) {
+		c_list_unlink_stale (elem);
+		c_list_link_after (lst, elem);
+		return TRUE;
+	}
+	return FALSE;
+}
+#define nm_c_list_move_front(lst, elem) nm_c_list_move_after (lst, elem)
+
 #endif /* __NM_C_LIST_H__ */