#ifndef ITS1_UTIL_H_INCLUDED
#define ITS1_UTIL_H_INCLUDED

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#ifndef NDEBUG
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__)
#else
#define ERROR(msg) /**/
#endif

#ifndef NELEM
#define NELEM(x) (sizeof(x) / sizeof(x[0]))
#endif

#endif

