[libc] Use QUEUE_TYPEOF in STAILQ_LAST (#79011)

This is to ensure this macro is compatible with both C and C++.
This commit is contained in:
Petr Hosek 2024-01-22 10:25:06 -08:00 committed by GitHub
parent d7fb9eb818
commit c0a74ad90c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -160,7 +160,9 @@
#define STAILQ_EMPTY(head) ((head)->first == NULL)
#define STAILQ_FIRST(head) ((head)->first)
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY(head) ? NULL : __containerof((head)->last, type, field.next))
(STAILQ_EMPTY(head) \
? NULL \
: __containerof((head)->last, QUEUE_TYPEOF(type), field.next))
#define STAILQ_NEXT(elem, field) ((elem)->field.next)
#define STAILQ_FOREACH(var, head, field) \