aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/stdlib.c')
-rw-r--r--src/stdlib/stdlib.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/stdlib/stdlib.c b/src/stdlib/stdlib.c
index a05b8753..b156692c 100644
--- a/src/stdlib/stdlib.c
+++ b/src/stdlib/stdlib.c
@@ -14,11 +14,12 @@
#include <time.h>
#include "../config.h"
+#include "../print.h"
+#include "../util.h"
#include "files.h"
#include "metamethods.h"
#include "optionals.h"
#include "paths.h"
-#include "print.h"
#include "siphash.h"
#include "stacktrace.h"
#include "stdlib.h"
@@ -158,16 +159,6 @@ void tomo_init(void) {
atexit(tomo_cleanup);
}
-public
-_Noreturn void fail_text(Text_t message) {
- fail(message);
-}
-
-public
-Text_t builtin_last_err() {
- return Text$from_str(strerror(errno));
-}
-
static int _inspect_depth = 0;
static file_t *file = NULL;
@@ -333,7 +324,10 @@ static cleanup_t *cleanups = NULL;
public
void tomo_at_cleanup(Closure_t fn) {
- cleanups = new (cleanup_t, .cleanup_fn = fn, .next = cleanups);
+ cleanup_t *new_cleanup = GC_MALLOC(sizeof(cleanup_t));
+ new_cleanup->cleanup_fn = fn;
+ new_cleanup->next = cleanups;
+ cleanups = new_cleanup;
}
public