From eece9692d707ccb20356ec06955f8308c4e59ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 17 Dec 2023 14:18:48 +0100 Subject: New upstream version 4.19 --- src/tc-list.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/tc-list.c') diff --git a/src/tc-list.c b/src/tc-list.c index e8a30b6..d31a5c7 100644 --- a/src/tc-list.c +++ b/src/tc-list.c @@ -10,6 +10,7 @@ #include #include #include +#include "internal.h" struct text_object { struct HXlist_head list; @@ -64,13 +65,14 @@ static void l_traverse(void) static void l_dump(bool pop) { static const char *const msg[] = {"Shifting", "Popping"}; - struct text_object *obj; unsigned int i = 0; - while ((obj = (pop ? - HXclist_pop(&strings_ct, struct text_object, list) : - HXclist_shift(&strings_ct, struct text_object, list) - )) != NULL) { + while (true) { + struct text_object *obj = pop ? + HXclist_pop(&strings_ct, struct text_object, list) : + HXclist_shift(&strings_ct, struct text_object, list); + if (obj == nullptr) + break; printf("%s item %u (\"%s\")\n", msg[pop], ++i, obj->id); #ifdef __cplusplus delete obj; @@ -138,7 +140,7 @@ static void l_shift(void) #pragma GCC diagnostic pop } -static int runner(int argc, const char **argv) +static int runner(int argc, char **argv) { unsigned int max = 10; @@ -157,10 +159,10 @@ static int runner(int argc, const char **argv) return EXIT_SUCCESS; } -int main(int argc, const char **argv) +int main(int argc, char **argv) { int ret = runner(argc, argv); - if (ret != EXIT_FAILURE) + if (ret == EXIT_FAILURE) fprintf(stderr, "FAILED\n"); return ret; } -- cgit v1.2.3