-
Notifications
You must be signed in to change notification settings - Fork 0
/
calloc.c
24 lines (21 loc) · 1.14 KB
/
calloc.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ffloris <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/03 13:39:16 by ffloris #+# #+# */
/* Updated: 2018/11/14 17:56:44 by ffloris ### ########.fr */
/* */
/* ************************************************************************** */
#include "malloc.h"
void *calloc(size_t elements_count, size_t element_size)
{
void *mem;
pthread_mutex_lock(&g_mutex);
if ((mem = allocate(elements_count * element_size)))
ft_bzero(mem, elements_count * element_size);
pthread_mutex_unlock(&g_mutex);
return (mem);
}