aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorAndrew Chambers <[email protected]>2021-10-07 01:53:34 +1300
committerAndrew Chambers <[email protected]>2021-10-07 01:53:34 +1300
commitf4a9a52d001a54ca1142110b70142a8ef8df53bc (patch)
tree95226e04b60c43b1143b7d27d7fe6905ae0b3dd4 /util.c
parent78aa469080b95f41fabc0f428bd4e5b1bbdaa04b (diff)
Work.
Diffstat (limited to 'util.c')
-rw-r--r--util.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/util.c b/util.c
index 5ab9c48..43c3d8b 100644
--- a/util.c
+++ b/util.c
@@ -10,15 +10,27 @@ static void vwarn(const char *fmt, va_list ap) {
}
}
-void fatal(const char *fmt, ...) {
+void lfatal(const char *fmt, ...) {
va_list ap;
+ fprintf(stderr, "%ld: ", curlineno);
+ va_start(ap, fmt);
+ vwarn(fmt, ap);
+ va_end(ap);
+ exit(1);
+}
+void fatal(const char *fmt, ...) {
+ va_list ap;
va_start(ap, fmt);
vwarn(fmt, ap);
va_end(ap);
exit(1);
}
+void unreachable(void) {
+ lfatal("BUG: unexpected internal condition");
+}
+
void *xmalloc(size_t n) {
void *p;