From 5b266bab1c35617a34989bd801e16854ad789f86 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Tue, 4 Jan 2022 11:08:10 +0100 Subject: feat: ERROR != assert --- shellsort.c | 3 +-- util.h | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/shellsort.c b/shellsort.c index b19f547..29e6bf8 100644 --- a/shellsort.c +++ b/shellsort.c @@ -37,8 +37,7 @@ test(T a[], size_t n) { for ( size_t i = 1; i < n; ++i ) { if ( a[i - 1] > a[i] ) { - fprintf(stderr, "Error\n"); - exit(EXIT_FAILURE); + ERROR("sortierung passt nicht"); } } } diff --git a/util.h b/util.h index df602e8..7ede6fd 100644 --- a/util.h +++ b/util.h @@ -4,7 +4,6 @@ #include #include -#ifndef NDEBUG static void error(const char *msg, ...) { @@ -18,10 +17,7 @@ error(const char *msg, ...) exit(EXIT_FAILURE); } -# define ERROR(msg) error(msg " in \"%s()\" (%s:%d)", __func__, __FILE__, __LINE__) -#else -# define ERROR(msg) /**/ -#endif +#define ERROR(msg) error(msg " in \"%s()\" (%s:%d)", __func__, __FILE__, __LINE__) #ifndef NELEM # define NELEM(x) (sizeof(x) / sizeof(x[0])) /* NOLINT */ -- cgit v1.3