-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memalloc.c
31 lines (27 loc) · 1.31 KB
/
ft_memalloc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memalloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aviholai <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/12 13:24:13 by aviholai #+# #+# */
/* Updated: 2022/02/04 15:37:59 by aviholai ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** 'Memalloc()' (memory allocation) allocates a section of memory the size
** of argument 'size' with the 'string.h' function 'malloc()' and uses the
** library function 'memset()' to set its area to '0'.
** The first process is a failsafe. If allocation fails, returns NULL.
*/
void *ft_memalloc(size_t size)
{
void *area;
area = malloc(size);
if (area == NULL)
return (NULL);
ft_memset(area, 0, size);
return (area);
}