From 84f127bfec4fe295770d5c848d7fef245ecbe0d1 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Thu, 16 Dec 2021 22:50:14 +0100 Subject: [PATCH] Move must_alloc into test.h --- src/test.h | 10 ++++++++++ src/tokenizer_test.c | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/test.h b/src/test.h index 90a5025..4ba376e 100644 --- a/src/test.h +++ b/src/test.h @@ -127,6 +127,16 @@ test_main(int argc, const char **argv, struct testdef tests[]) return allok ? 0 : 1; } +static void * +must_alloc(testctx t, size_t size) +{ + void *out = malloc(size); + if (out == NULL) { + test_fatalf(t, "Failed allocating %d bytes of memory", size); + } + return out; +} + #define TESTS_BEGIN \ int main(int argc, const char **argv) \ { \ diff --git a/src/tokenizer_test.c b/src/tokenizer_test.c index 60455c4..351a4de 100644 --- a/src/tokenizer_test.c +++ b/src/tokenizer_test.c @@ -4,16 +4,6 @@ #include "test.h" -static void * -must_alloc(testctx t, size_t size) -{ - void *out = malloc(size); - if (out == NULL) { - test_fatalf(t, "Failed allocating %d bytes of memory", size); - } - return out; -} - struct tokenizer_test { testctx t; apfl_tokenizer_ptr tokenizer;