summaryrefslogtreecommitdiff
path: root/src/tc-list.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2023-12-17 14:16:17 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2023-12-17 14:16:17 +0100
commit2543e1e9838e03adb7f4a811815d34ccf65a3026 (patch)
tree92fd5e78541bb9c244741de5940e8332e5e983dc /src/tc-list.c
parent6eddfddeb9da77b6523d8e1ebc2e75c8b5dc5ac9 (diff)
parent08dcb1504d4900cb6230c99fbbf535c63eb3b332 (diff)
Merge branch 'release/debian/4.17-1'
Diffstat (limited to 'src/tc-list.c')
-rw-r--r--src/tc-list.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/tc-list.c b/src/tc-list.c
index 2fd6380..e8a30b6 100644
--- a/src/tc-list.c
+++ b/src/tc-list.c
@@ -22,7 +22,7 @@ union list_encap {
static HXCLIST_HEAD(strings_ct);
-static void l_init(unsigned int max, bool unshift)
+static int l_init(unsigned int max, bool unshift)
{
static const char *const msg[] = {"Pushing", "Unshifting"};
struct text_object *obj;
@@ -34,7 +34,7 @@ static void l_init(unsigned int max, bool unshift)
#else
obj = malloc(sizeof(*obj));
if (obj == NULL)
- abort();
+ return EXIT_FAILURE;
#endif
HXlist_init(&obj->list);
obj->id[0] = HX_irand('a', 'z'+1);
@@ -48,6 +48,7 @@ static void l_init(unsigned int max, bool unshift)
else
HXclist_push(&strings_ct, &obj->list);
}
+ return EXIT_SUCCESS;
}
static void l_traverse(void)
@@ -137,16 +138,17 @@ static void l_shift(void)
#pragma GCC diagnostic pop
}
-int main(int argc, const char **argv)
+static int runner(int argc, const char **argv)
{
unsigned int max = 10;
if (HX_init() <= 0)
- abort();
+ return EXIT_FAILURE;
if (argc >= 2)
max = strtoul(argv[1], NULL, 0);
-
- l_init(max, HX_rand() & 1);
+ int ret = l_init(max, HX_rand() & 1);
+ if (ret != EXIT_SUCCESS)
+ return ret;
l_traverse();
l_dump(HX_rand() & 1);
l_empty();
@@ -154,3 +156,11 @@ int main(int argc, const char **argv)
HX_exit();
return EXIT_SUCCESS;
}
+
+int main(int argc, const char **argv)
+{
+ int ret = runner(argc, argv);
+ if (ret != EXIT_FAILURE)
+ fprintf(stderr, "FAILED\n");
+ return ret;
+}