From: Christian Brauner Date: Thu, 25 Mar 2021 22:32:35 +0000 (+0100) Subject: list: add lxc_list_new() helper X-Git-Tag: lxc-5.0.0~246^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89d34eb2eda5c2e6bf9ffa8382bba41d0257828e;p=thirdparty%2Flxc.git list: add lxc_list_new() helper Signed-off-by: Christian Brauner --- 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 */