summaryrefslogtreecommitdiff
path: root/src/tc-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tc-list.c')
-rw-r--r--src/tc-list.c18
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;
}