aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
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;