From 86625b1166bd39e28b4dd4995ed6cd88c0bdde7e Mon Sep 17 00:00:00 2001 From: lemon Date: Tue, 6 Jun 2023 15:08:46 +0200 Subject: codegen skeleton --- io.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 9156d27..cc94a08 100644 --- a/io.c +++ b/io.c @@ -670,14 +670,6 @@ Err: return f; } -void -_assertfmt(const char *file, int line, const char *func, const char *expr) -{ - ioflush(&bstdout); - efmt("%s:%d: %s: Assertion `%s' failed.\n", file, line, func, expr); - ioflush(&bstderr); -} - void mapclose(struct memfile *f) { @@ -686,6 +678,21 @@ mapclose(struct memfile *f) memset(f, 0, sizeof *f); } +void * +mapzeros(uint N) +{ + void *p = mmap(NULL, N, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + return p == MAP_FAILED ? NULL : p; +} + +void +_assertfmt(const char *file, int line, const char *func, const char *expr) +{ + ioflush(&bstdout); + efmt("%s:%d: %s: Assertion `%s' failed.\n", file, line, func, expr); + ioflush(&bstderr); +} + static struct file { const char *path; struct memfile f; -- cgit v1.2.3