From 3811ff53a60cc6e7277e5de98e696a9a76c36a9e Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 16 Dec 2023 12:02:23 +0000 Subject: Extract alloc.{h,c} --- runtime/meson.build | 2 +- runtime/src/alloc.c | 15 +++++++++++++++ runtime/src/alloc.h | 8 ++++++++ runtime/src/shed.c | 17 ----------------- 4 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 runtime/src/alloc.c create mode 100644 runtime/src/alloc.h delete mode 100644 runtime/src/shed.c (limited to 'runtime') diff --git a/runtime/meson.build b/runtime/meson.build index 03ad07de..5c679a54 100644 --- a/runtime/meson.build +++ b/runtime/meson.build @@ -2,10 +2,10 @@ project('shed-runtime', 'c', default_options : ['warning_level=1']) static_library( 'shed', 'src/patio/exceptions.c', + 'src/alloc.c', 'src/effects.c', 'src/ints.c', 'src/primitives.c', - 'src/shed.c', 'src/strings.c', 'src/namespaces/Shed/Builtins.c', ) diff --git a/runtime/src/alloc.c b/runtime/src/alloc.c new file mode 100644 index 00000000..f7972fbf --- /dev/null +++ b/runtime/src/alloc.c @@ -0,0 +1,15 @@ +#include "./std/unistd.h" + +#ifdef __WASM__ + +void* malloc(unsigned long); + +#else + +#include + +#endif + +void* shed__runtime__alloc(size_t size) { + return malloc(size); +} diff --git a/runtime/src/alloc.h b/runtime/src/alloc.h new file mode 100644 index 00000000..b0a4e1cd --- /dev/null +++ b/runtime/src/alloc.h @@ -0,0 +1,8 @@ +#ifndef SHED_ALLOC_H +#define SHED_ALLOC_H + +#include "./std/unistd.h" + +void* shed__runtime__alloc(size_t size); + +#endif diff --git a/runtime/src/shed.c b/runtime/src/shed.c deleted file mode 100644 index 05e5dd9b..00000000 --- a/runtime/src/shed.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#ifndef __WASM__ -#include -#endif - -#include "./shed.h" - -#ifdef __WASM__ - -void* malloc(unsigned long); - -#endif - -void* shed__runtime__alloc(size_t size) { - return malloc(size); -} -- cgit v1.2.3