blob: 7ede6fd8fc0fc0569658c86eba7f83d5f7b2a9cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#pragma once
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
static void
error(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
fprintf(stderr, "Error: ");
vfprintf(stderr, msg, ap);
va_end(ap);
fprintf(stderr, "\n");
exit(EXIT_FAILURE);
}
#define ERROR(msg) error(msg " in \"%s()\" (%s:%d)", __func__, __FILE__, __LINE__)
#ifndef NELEM
# define NELEM(x) (sizeof(x) / sizeof(x[0])) /* NOLINT */
#endif
|