aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2022-04-09 09:43:53 +0200
committerThomas Schmucker <ts@its1.de>2022-04-09 09:43:53 +0200
commit154874afda4a8df885e51c01f7681f04fb0b8e61 (patch)
tree274817eb2793584b0e3d856de5504a614f2b4e89 /src/util.h
parent2863f4f1d2a6a6a8704454824d6c291d2e0d4b5c (diff)
downloaddata-structures-154874afda4a8df885e51c01f7681f04fb0b8e61.tar.gz
data-structures-154874afda4a8df885e51c01f7681f04fb0b8e61.tar.bz2
data-structures-154874afda4a8df885e51c01f7681f04fb0b8e61.zip
neue Verzeichnisstruktur
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
new file mode 100644
index 0000000..7ede6fd
--- /dev/null
+++ b/src/util.h
@@ -0,0 +1,24 @@
1#pragma once
2
3#include <stdarg.h>
4#include <stdio.h>
5#include <stdlib.h>
6
7static void
8error(const char *msg, ...)
9{
10 va_list ap;
11
12 va_start(ap, msg);
13 fprintf(stderr, "Error: ");
14 vfprintf(stderr, msg, ap);
15 va_end(ap);
16 fprintf(stderr, "\n");
17 exit(EXIT_FAILURE);
18}
19
20#define ERROR(msg) error(msg " in \"%s()\" (%s:%d)", __func__, __FILE__, __LINE__)
21
22#ifndef NELEM
23# define NELEM(x) (sizeof(x) / sizeof(x[0])) /* NOLINT */
24#endif