From f9d7308014e11192db9594cc6ea6184995b2af37 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Mon, 20 Jun 2022 18:35:06 +0800 Subject: [PATCH] util: Use literal instead call to list_inithead in u_queue.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a more convenient way to struct list_head variable. And removed the need to call list_inithead in global_init Signed-off-by: Yonggang Luo Reviewed-by: Marek Olšák Part-of: --- src/util/u_queue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/u_queue.c b/src/util/u_queue.c index df2f2da4a95..ed8ad300ea0 100644 --- a/src/util/u_queue.c +++ b/src/util/u_queue.c @@ -55,7 +55,10 @@ util_queue_kill_threads(struct util_queue *queue, unsigned keep_num_threads, */ static once_flag atexit_once_flag = ONCE_FLAG_INIT; -static struct list_head queue_list; +static struct list_head queue_list = { + .next = &queue_list, + .prev = &queue_list, +}; static mtx_t exit_mutex = _MTX_INITIALIZER_NP; static void @@ -74,7 +77,6 @@ atexit_handler(void) static void global_init(void) { - list_inithead(&queue_list); atexit(atexit_handler); }