Made a memory allocator (crude)

This commit is contained in:
Maieul BOYER 2024-05-07 15:21:41 +02:00
parent b5c7344851
commit 941bac31b6
No known key found for this signature in database
53 changed files with 469 additions and 146 deletions

View file

@ -6,20 +6,15 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/06 15:53:21 by maiboyer #+# #+# */
/* Updated: 2023/12/09 18:14:47 by maiboyer ### ########.fr */
/* Updated: 2024/05/07 12:46:04 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/mem/mem_alloc.h"
#include "me/alloc/alloc.h"
#include "me/mem/mem_alloc_array.h"
#include <stdlib.h>
void *mem_alloc_array(t_usize item_count, t_usize item_size)
{
t_usize multiplied;
multiplied = item_count * item_size;
if (multiplied == 0 || multiplied / item_count != item_size)
return (NULL);
return (mem_alloc(multiplied));
return (me_calloc(item_count, item_size));
}