aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/main.c')
-rw-r--r--tests/src/main.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/tests/src/main.c b/tests/src/main.c
deleted file mode 100644
index 0ded605..0000000
--- a/tests/src/main.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @file main.c
- * @brief Smoke test — call malloc once and print the returned pointer.
- *
- * Uses write(2) instead of printf to avoid stdio calling malloc
- * internally, which would pollute output under LD_PRELOAD.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-
-/** @brief Write the hex representation of @p ptr to stdout. */
-static void
-_s_put_ptr (void *ptr)
-{
- const char hex[] = "0123456789abcdef";
- char buf[20];
- unsigned long v = (unsigned long)ptr;
- int i;
-
- if (!ptr)
- {
- write (1, "(nil)", 5);
- return;
- }
- i = (int)sizeof (buf);
- while (v)
- {
- buf[--i] = hex[v % 16];
- v /= 16;
- }
- buf[--i] = 'x';
- buf[--i] = '0';
- write (1, buf + i, (size_t)(sizeof (buf) - i));
-}
-
-int
-main (void)
-{
- void *p = malloc (42);
- write (1, "malloc(42) = ", 13);
- _s_put_ptr (p);
- write (1, "\n", 1);
- free (p);
- return (0);
-}