aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shellsort.c3
-rw-r--r--util.h6
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)
37{ 37{
38 for ( size_t i = 1; i < n; ++i ) { 38 for ( size_t i = 1; i < n; ++i ) {
39 if ( a[i - 1] > a[i] ) { 39 if ( a[i - 1] > a[i] ) {
40 fprintf(stderr, "Error\n"); 40 ERROR("sortierung passt nicht");
41 exit(EXIT_FAILURE);
42 } 41 }
43 } 42 }
44} 43}
diff --git a/util.h b/util.h
index df602e8..7ede6fd 100644
--- a/util.h
+++ b/util.h
@@ -4,7 +4,6 @@
4#include <stdio.h> 4#include <stdio.h>
5#include <stdlib.h> 5#include <stdlib.h>
6 6
7#ifndef NDEBUG
8static void 7static void
9error(const char *msg, ...) 8error(const char *msg, ...)
10{ 9{
@@ -18,10 +17,7 @@ error(const char *msg, ...)
18 exit(EXIT_FAILURE); 17 exit(EXIT_FAILURE);
19} 18}
20 19
21# define ERROR(msg) error(msg " in \"%s()\" (%s:%d)", __func__, __FILE__, __LINE__) 20#define ERROR(msg) error(msg " in \"%s()\" (%s:%d)", __func__, __FILE__, __LINE__)
22#else
23# define ERROR(msg) /**/
24#endif
25 21
26#ifndef NELEM 22#ifndef NELEM
27# define NELEM(x) (sizeof(x) / sizeof(x[0])) /* NOLINT */ 23# define NELEM(x) (sizeof(x) / sizeof(x[0])) /* NOLINT */