mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-08-28 11:45:14 -05:00
This commit reduces our romsize by 3KB by optimizing away libc's malloc() function
The problem was that our custom_malloc was not marking these functions as extern "C". Therefore libc's malloc function and everything linked to it was still getting pulled into our rom. Fix: mark these functions as extern "C". This ensures that these functions aren't getting pulled in from libc. This reduces our rom size by 3KB
This commit is contained in:
@@ -201,6 +201,9 @@ void malloc_init_default_pool(void)
|
||||
memset(g_alloc_map, 0, sizeof(g_alloc_map)); // Clear bitmap
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
/// @brief The custom implementation of the bitmap allocator described at the top of this module.
|
||||
void* malloc(size_t size)
|
||||
{
|
||||
@@ -333,6 +336,8 @@ void _free_r(struct _reent *r, void* ptr) {
|
||||
return free(ptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void malloc_init_default_pool(void)
|
||||
|
||||
Reference in New Issue
Block a user