From dee51406f2d7f8b07014ca4b0ce41998e0c25023 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 25 Mar 2021 23:32:35 +0100 Subject: [PATCH] list: add lxc_list_new() helper Signed-off-by: Christian Brauner --- src/lxc/list.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lxc/list.h b/src/lxc/list.h index e329b7e00..c984af451 100644 --- a/src/lxc/list.h +++ b/src/lxc/list.h @@ -5,6 +5,8 @@ #include +#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 */ -- 2.47.3