From bdadee5dff7dd14076afebd67d23d9d7269fb40f Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 5 Feb 2025 12:22:37 -0400 Subject: [PATCH] MT#55283 add extra typed container methods Change-Id: I406238c947b3b02341f021dbacb6cb06502181ec --- lib/containers.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/containers.h b/lib/containers.h index 2665ac4b3..163a0d2c4 100644 --- a/lib/containers.h +++ b/lib/containers.h @@ -254,6 +254,11 @@ static inline void g_queue_clear_full(GQueue *q, GDestroyNotify free_func) { g_queue_push_head(&(Q)->q, __e); \ }) +#define t_queue_push_head_link(Q, k) ({ \ + __typeof__((Q)->head) __l = k; \ + g_queue_push_head_link(&(Q)->q, &__l->l); \ + }) + #define t_queue_push_tail(Q, e) ({ \ __typeof__((Q)->__t) __e = e; \ g_queue_push_tail(&(Q)->q, __e); \ @@ -305,6 +310,11 @@ static inline void g_queue_clear_full(GQueue *q, GDestroyNotify free_func) { g_queue_delete_link(&(Q)->q, &(__l)->l); \ }) +#define t_queue_unlink(Q, L) ({ \ + __typeof__((Q)->head) __l = L; \ + g_queue_unlink(&(Q)->q, &(__l)->l); \ + }) + #define t_queue_find_custom(Q, e, f) ({ \ int (*__f)(__typeof__((Q)->__ct), const void *) = f; \ GList *__l = g_queue_find_custom(&(Q)->q, e, (GCompareFunc) __f); \