Switched back to libc's allocator until I fix every bug
This commit is contained in:
parent
f75685a6c7
commit
b96c5e1e66
3 changed files with 11 additions and 7 deletions
|
|
@ -39,7 +39,7 @@
|
|||
#define STACK_VERSION_NONE ((t_stack_version)-1)
|
||||
#define TS_DECODE_ERROR (-1)
|
||||
|
||||
#if false
|
||||
#if true
|
||||
# undef malloc
|
||||
# undef calloc
|
||||
# undef realloc
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/14 18:26:27 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/18 18:48:25 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/22 14:58:57 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,8 +25,8 @@ t_allocator *global_allocator(void)
|
|||
if (!init)
|
||||
{
|
||||
init = true;
|
||||
global_alloc = m_init();
|
||||
// global_alloc = lc_init();
|
||||
//global_alloc = m_init();
|
||||
global_alloc = lc_init();
|
||||
}
|
||||
return (&global_alloc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,19 +6,23 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/06 14:47:49 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/14 18:32:31 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/22 15:01:06 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "me/mem/mem.h"
|
||||
#include "me/mem/_allocator.h"
|
||||
#include "me/mem/mem.h"
|
||||
|
||||
void *mem_alloc(t_usize size)
|
||||
{
|
||||
t_allocator *a;
|
||||
void *ret;
|
||||
|
||||
a = global_allocator();
|
||||
return (a->alloc(a, size));
|
||||
ret = a->alloc(a, size);
|
||||
if (ret != NULL)
|
||||
mem_set_zero(ret, size);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void mem_free(void *ptr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue