Normed most of the stdme

This commit is contained in:
Maieul BOYER 2024-07-10 18:06:10 +02:00
parent 882d5cb5bb
commit ac5458d42c
No known key found for this signature in database
31 changed files with 149 additions and 617 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/14 18:26:27 by maiboyer #+# #+# */
/* Updated: 2024/07/07 19:10:07 by maiboyer ### ########.fr */
/* Updated: 2024/07/10 17:48:46 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,23 +17,23 @@
#include "me/types.h"
#include <stdio.h>
t_allocator *global_allocator(void)
t_allocator *global_allocator(void)
{
static t_allocator global_alloc = {};
static bool init = false;
static t_allocator global_alloc = {};
static bool init = false;
if (!init)
{
init = true;
global_alloc = m_init();
// global_alloc = lc_init();
}
return (&global_alloc);
}
__attribute__((destructor(200)))
void uninit_global_allocator(void)
void uninit_global_allocator(void)
{
t_allocator *allocator;
t_allocator *allocator;
allocator = global_allocator();
vg_mem_defined(allocator, sizeof(*allocator));

View file

@ -6,16 +6,16 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/06 14:47:49 by maiboyer #+# #+# */
/* Updated: 2024/05/22 15:01:06 by maiboyer ### ########.fr */
/* Updated: 2024/07/10 17:48:20 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/mem/_allocator.h"
#include "me/mem/mem.h"
void *mem_alloc(t_usize size)
void *mem_alloc(t_usize size)
{
t_allocator *a;
t_allocator *a;
void *ret;
a = global_allocator();
@ -25,9 +25,9 @@ void *mem_alloc(t_usize size)
return (ret);
}
void mem_free(void *ptr)
void mem_free(void *ptr)
{
t_allocator *a;
t_allocator *a;
a = global_allocator();
return (a->free(a, ptr));

View file

@ -6,16 +6,16 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/06 15:53:21 by maiboyer #+# #+# */
/* Updated: 2024/05/14 18:30:27 by maiboyer ### ########.fr */
/* Updated: 2024/07/10 17:47:03 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/mem/mem.h"
#include "me/mem/_allocator.h"
void *mem_alloc_array(t_usize size, t_usize count)
void *mem_alloc_array(t_usize size, t_usize count)
{
t_allocator *a;
t_allocator *a;
a = global_allocator();
return (a->alloc_array(a, size, count));

View file

@ -6,23 +6,23 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/07 12:46:18 by maiboyer #+# #+# */
/* Updated: 2024/05/14 18:32:06 by maiboyer ### ########.fr */
/* Updated: 2024/07/10 17:47:21 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/mem/_allocator.h"
void *mem_realloc(void *ptr, t_usize size)
void *mem_realloc(void *ptr, t_usize size)
{
t_allocator *a;
t_allocator *a;
a = global_allocator();
return (a->realloc(a, ptr, size));
}
void *mem_realloc_array(void *ptr, t_usize size, t_usize count)
void *mem_realloc_array(void *ptr, t_usize size, t_usize count)
{
t_allocator *a;
t_allocator *a;
a = global_allocator();
return (a->realloc_array(a, ptr, size, count));