From 8ab206c26a5a175402a141d198cc958308152051 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 27 Feb 2025 10:38:06 -0400 Subject: [PATCH] MT#61625 add t_slist_free_full wrapper Change-Id: Ib47bc4890ecfeac5a6814505abe77b4454cda5e3 --- lib/containers.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/containers.h b/lib/containers.h index ae2e06a32..237a50b53 100644 --- a/lib/containers.h +++ b/lib/containers.h @@ -407,6 +407,11 @@ static inline void g_queue_clear_full(GQueue *q, GDestroyNotify free_func) { __ret; \ }) +#define t_slist_free_full(L, f) ({ \ + void (*__fn)(__typeof__((L)->data)) = (f); \ + g_slist_free_full(&(L)->l, (GDestroyNotify) __fn); \ + }) + #define t_slist_delete_link(L, k) ({ \ GSList *__r = g_slist_delete_link(&(L)->l, &(k)->l); \ __typeof__(L) __ret = (__typeof__(L)) __r; \