diff options
author | Niels Möller <nisse@lysator.liu.se> | 2013-02-15 16:29:26 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2013-02-15 16:29:26 +0100 |
commit | cf7b560216f6dab91cd937db8da8d4ee721e6a1d (patch) | |
tree | 9fb9240ec59174a8d808e6828260c894ff589680 /testsuite | |
parent | 84447d244b028c4f52f9ab735641a3047a2612ae (diff) | |
download | nettle-cf7b560216f6dab91cd937db8da8d4ee721e6a1d.tar.gz |
Added die function to testutils.c.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/testutils.c | 18 | ||||
-rw-r--r-- | testsuite/testutils.h | 6 |
2 files changed, 20 insertions, 4 deletions
diff --git a/testsuite/testutils.c b/testsuite/testutils.c index 14d5df29..dfe084e8 100644 --- a/testsuite/testutils.c +++ b/testsuite/testutils.c @@ -10,9 +10,6 @@ #include <assert.h> #include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> /* -1 means invalid */ static const signed char hex_digits[0x100] = @@ -35,6 +32,21 @@ static const signed char hex_digits[0x100] = -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }; +void +die(const char *format, ...) +{ + va_list args; + va_start(args, format); +#if WITH_HOGWEED + gmp_vfprintf(stderr, format, args); +#else + vfprintf(stderr, format, args); +#endif + va_end(args); + + abort (); +} + void * xalloc(size_t size) { diff --git a/testsuite/testutils.h b/testsuite/testutils.h index 14aa794d..8b470697 100644 --- a/testsuite/testutils.h +++ b/testsuite/testutils.h @@ -7,9 +7,10 @@ #include "nettle-types.h" -#include <string.h> +#include <stdarg.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> #if HAVE_LIBGMP # include "bignum.h" @@ -33,6 +34,9 @@ struct nettle_aead; extern "C" { #endif +void +die(const char *format, ...) PRINTF_STYLE (1, 2) NORETURN; + void * xalloc(size_t size); |