Skip to content

Commit 8e5c8f9

Browse files
committed
libc: fix using a custom allocator.
1 parent 8a22267 commit 8e5c8f9

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/libc/allocator.src

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,29 @@ if defined ALLOCATOR_SIMPLE
3232
_malloc := __simple_malloc
3333
_free := __simple_free
3434
_realloc := __simple_realloc
35+
extern __simple_free
36+
extern __simple_malloc
37+
extern __simple_realloc
3538

36-
end if
37-
38-
if defined ALLOCATOR_STANDARD
39+
else if defined ALLOCATOR_STANDARD
3940

4041
_malloc := __standard_malloc
4142
_free := __standard_free
4243
_realloc := __standard_realloc
43-
44-
end if
45-
46-
extern __simple_free
47-
extern __simple_malloc
48-
extern __simple_realloc
4944
extern __standard_malloc
5045
extern __standard_free
5146
extern __standard_realloc
47+
48+
else ; custom functions provided by the program
49+
50+
_malloc := __custom_malloc
51+
_free := __custom_free
52+
_realloc := __custom_realloc
53+
extern __custom_malloc
54+
extern __custom_free
55+
extern __custom_realloc
56+
57+
end if
58+
5259
extern __imulu
5360
extern _memset

0 commit comments

Comments
 (0)