Made a memory allocator (crude)
This commit is contained in:
parent
b5c7344851
commit
941bac31b6
53 changed files with 469 additions and 146 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue