aboutsummaryrefslogtreecommitdiff
path: root/lib/die.c
blob: f58195132c47c1046c000acc3f429b292a0d5835 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "impl.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#undef hkvs_die
void hkvs_die(const char *msg) {
	hkvs_die_ext(NULL, NULL, 0, msg);
}

void hkvs_die_ext(const char *func, const char *file, int line, const char *msg) {
	(void)file;
	if(func) {
		fprintf(stderr, "Internal error: [%s:%d] %s\n", func, line, msg);
	} else {
		fprintf(stderr, "Internal error: %s\n", msg);
	}
	abort();
}