]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
list: add lxc_list_new() helper
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 25 Mar 2021 22:32:35 +0000 (23:32 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 25 Mar 2021 22:33:12 +0000 (23:33 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/list.h

index e329b7e0000fb80c85b18ff74af69697d133b54c..c984af4512fe1cbf7599abb4a85433fc03638555 100644 (file)
@@ -5,6 +5,8 @@
 
 #include <stdio.h>
 
+#include "memory_utils.h"
+
 struct lxc_list {
        void *elem;
        struct lxc_list *next;
@@ -143,4 +145,14 @@ static inline size_t lxc_list_len(struct lxc_list *list)
        return i;
 }
 
+static inline struct lxc_list *lxc_list_new(void)
+{
+       struct lxc_list *l;
+
+       l = zalloc(sizeof(struct lxc_list));
+       if (l)
+               lxc_list_init(l);
+       return l;
+}
+
 #endif /* __LXC_LIST_H */