From e3585383be57ec108d8adf4b93fd6eecb0b0fae3 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Sat, 29 Dec 2018 14:15:04 -0600 Subject: [PATCH] unit: Update to the new stkutil api --- unit/test-stkutil.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c index 6a5fd3de..c595ac1c 100644 --- a/unit/test-stkutil.c +++ b/unit/test-stkutil.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include "smsutil.h" @@ -186,14 +186,14 @@ static inline void check_item_id(const unsigned char command, check_common_byte(command, test); } -static void check_items(GSList *command, const struct stk_item *test) +static void check_items(struct l_queue *command, const struct stk_item *test) { struct stk_item *si; - GSList *l; + const struct l_queue_entry *entry; unsigned int i = 0; - for (l = command; l; l = l->next) { - si = l->data; + for (entry = l_queue_get_entries(command); entry; entry = entry->next) { + si = entry->data; check_item(si, &test[i++]); } @@ -319,16 +319,17 @@ static inline void check_ussd(const struct stk_ussd_string *command, } /* Defined in TS 102.223 Section 8.18 */ -static void check_file_list(GSList *command, const struct stk_file *test) +static void check_file_list(struct l_queue *command, + const struct stk_file *test) { struct stk_file *sf; - GSList *l; + const struct l_queue_entry *entry = l_queue_get_entries(command); unsigned int i = 0; - for (l = command; l; l = l->next) { - sf = l->data; + for (; entry; entry = entry->next) { + sf = entry->data; g_assert(sf->len == test[i].len); - g_assert(g_mem_equal(sf->file, test[i++].file, sf->len)); + g_assert(!memcmp(sf->file, test[i++].file, sf->len)); } g_assert(test[i].len == 0); @@ -458,14 +459,14 @@ static void check_provisioning_file_reference(const struct stk_file *command, g_assert(g_mem_equal(command->file, test->file, test->len)); } -static void check_provisioning_file_references(GSList *command, +static void check_provisioning_file_references(struct l_queue *command, const struct stk_file *test) { struct stk_file *sf; - GSList *l; + const struct l_queue_entry *l; unsigned int i = 0; - for (l = command; l; l = l->next) { + for (l = l_queue_get_entries(command); l; l = l->next) { sf = l->data; check_provisioning_file_reference(sf, &test[i++]); }