diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-12-17 14:20:52 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-12-17 14:20:52 +0100 |
commit | 6f600257a5d03bfab2452da05dd62f274065c519 (patch) | |
tree | 18ce4d6e2adcf5303c77cc03c9c468a7afa251f9 /src/tc-list.c | |
parent | 5400fb6e98435efe682b4a9de7266579b634de3c (diff) | |
parent | 96da31f8cb9ec57313ab496a9ce07b108ec3914f (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/tc-list.c')
-rw-r--r-- | src/tc-list.c | 18 |
1 files changed, 10 insertions, 8 deletions
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 <libHX/list.h> #include <libHX/init.h> #include <libHX/misc.h> +#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; } |