summaryrefslogtreecommitdiffstatshomepage
path: root/stm/malloc0.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm/malloc0.c')
-rw-r--r--stm/malloc0.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/stm/malloc0.c b/stm/malloc0.c
index fc0267911d..686dfbf4be 100644
--- a/stm/malloc0.c
+++ b/stm/malloc0.c
@@ -1,6 +1,9 @@
#include <stdint.h>
#include "std.h"
+#include "mpyconfig.h"
+#include "gc.h"
+#if 0
static uint32_t mem = 0;
void *malloc(size_t n) {
@@ -20,6 +23,12 @@ void *malloc(size_t n) {
void free(void *ptr) {
}
+void *realloc(void *ptr, size_t n) {
+ return malloc(n);
+}
+
+#endif
+
void *calloc(size_t sz, size_t n) {
char *ptr = malloc(sz * n);
for (int i = 0; i < sz * n; i++) {
@@ -28,8 +37,15 @@ void *calloc(size_t sz, size_t n) {
return ptr;
}
+void *malloc(size_t n) {
+ return gc_alloc(n);
+}
+
+void free(void *ptr) {
+}
+
void *realloc(void *ptr, size_t n) {
- return malloc(n);
+ return gc_realloc(ptr, n);
}
void __assert_func() {