summaryrefslogtreecommitdiff
path: root/src/tc-list.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2023-11-21 09:56:28 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2023-11-21 09:56:28 +0100
commit45e1231149779c363c9abb78cc09e21d047c463f (patch)
tree111b91a23e747bb2c9df60b0170914cbbd74dec3 /src/tc-list.c
parentd391e80c7378e6604c8f84538f27df8b915ebd2a (diff)
parent987942a206ef0f2342bf81d5de6432c6af42b7e7 (diff)
Update upstream source from tag 'upstream/4.17'
Update to upstream version '4.17' with Debian dir da192eda54f0b421cbc1b9ba383659593db8d3db
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;
+}