GCC Code Coverage Report


Directory: ./
File: lib/mymemory/my_calloc.c
Date: 2024-06-05 02:24:39
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 1 1 100.0%
Branches: 9 10 90.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2024
3 ** my_calloc
4 ** File description:
5 ** The my_calloc.c
6 */
7
8 #include "mymemory.h"
9
10 5 void *my_calloc(size_t element_count, size_t element_size, int type)
11 {
12 static linked_list_t *list = NULL;
13 void *ptr;
14
15
5/6
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
5 if (type == 1 && element_count > 0 && element_size > 0) {
16 2 ptr = malloc(element_count * element_size);
17
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 if (ptr == NULL)
18 1 return NULL;
19 1 my_push_front(&list, ptr, VOID);
20 1 my_memset(ptr, 0, element_count);
21 1 return ptr;
22 }
23
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 if (type == 0)
24 2 my_delete_list(&list);
25 3 return NULL;
26 }
27