From cb554fd342b4322970f1cfbd1776056a5c235b43 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 15 Nov 2024 17:06:47 +0100 Subject: [PATCH] tests/unittests: use proper initializers for gnrc_pktsnip_t --- tests/unittests/tests-pktbuf/tests-pktbuf.c | 5 ++++- tests/unittests/tests-pktqueue/tests-pktqueue.c | 4 ++-- .../tests-priority_pktqueue/tests-priority_pktqueue.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/unittests/tests-pktbuf/tests-pktbuf.c b/tests/unittests/tests-pktbuf/tests-pktbuf.c index a78fd16c84..cb9b30479f 100644 --- a/tests/unittests/tests-pktbuf/tests-pktbuf.c +++ b/tests/unittests/tests-pktbuf/tests-pktbuf.c @@ -325,7 +325,10 @@ static void test_pktbuf_mark__pkt_NOT_NULL__size_greater_than_pkt_size(void) static void test_pktbuf_mark__pkt_NOT_NULL__pkt_data_NULL(void) { - gnrc_pktsnip_t pkt = { NULL, NULL, sizeof(TEST_STRING16), 1, GNRC_NETTYPE_TEST }; + gnrc_pktsnip_t pkt = { .size = sizeof(TEST_STRING16), + .type = GNRC_NETTYPE_TEST, + .users = 1, + }; TEST_ASSERT_NULL(gnrc_pktbuf_mark(&pkt, sizeof(TEST_STRING16) - 1, GNRC_NETTYPE_TEST)); diff --git a/tests/unittests/tests-pktqueue/tests-pktqueue.c b/tests/unittests/tests-pktqueue/tests-pktqueue.c index 858d9005d4..84795307c6 100644 --- a/tests/unittests/tests-pktqueue/tests-pktqueue.c +++ b/tests/unittests/tests-pktqueue/tests-pktqueue.c @@ -21,8 +21,8 @@ #include "unittests-constants.h" #include "tests-pktqueue.h" -#define PKT_INIT_ELEM(len, data, next) \ - { (next), (void *)(data), (len), 1, GNRC_NETTYPE_UNDEF } +#define PKT_INIT_ELEM(len, ptr, nxt) \ + { .next = (nxt), .data = (void *)(ptr), .size = (len), .users = 1, .type = GNRC_NETTYPE_UNDEF } #define PKT_INIT_ELEM_STATIC_DATA(data, next) PKT_INIT_ELEM(sizeof(data), (void *)(data), (next)) #define PKTQUEUE_INIT_ELEM(pkt) { NULL, pkt } diff --git a/tests/unittests/tests-priority_pktqueue/tests-priority_pktqueue.c b/tests/unittests/tests-priority_pktqueue/tests-priority_pktqueue.c index faed65340a..cc5b8ca7ba 100644 --- a/tests/unittests/tests-priority_pktqueue/tests-priority_pktqueue.c +++ b/tests/unittests/tests-priority_pktqueue/tests-priority_pktqueue.c @@ -22,8 +22,8 @@ #include "unittests-constants.h" #include "tests-priority_pktqueue.h" -#define PKT_INIT_ELEM(len, data, next) \ - { (next), (void *)(data), (len), 1, GNRC_NETTYPE_UNDEF } +#define PKT_INIT_ELEM(len, ptr, nxt) \ + { .next = (nxt), .data = (void *)(ptr), .size = (len), .users = 1, .type = GNRC_NETTYPE_UNDEF } #define PKT_INIT_ELEM_STATIC_DATA(data, next) PKT_INIT_ELEM(sizeof(data), (void *)(data), (next)) #define PKTQUEUE_INIT_ELEM(pkt) { NULL, pkt }