GCC Code Coverage Report


Directory: ./
File: lib/my/my_params_to_array.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 1 1 100.0%
Branches: 2 2 100.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_params_to_array
4 ** File description:
5 ** Returns a info_params struct of the argc (ac) and the argv (av)
6 */
7 /**
8 * @file my_params_to_array.c
9 * @brief The file containing the my_params_to_array function
10 * @author Nicolas TORO
11 */
12
13 #include "my.h"
14
15 2 struct info_param *my_params_to_array(int ac, char **av)
16 {
17 struct info_param *result;
18 2 int i = 0;
19
20 2 result = malloc(sizeof(struct info_param) * (ac + 1));
21
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 for (; i < ac; i++) {
22 1 result[i].length = my_strlen(av[i]);
23 1 result[i].str = av[i];
24 1 result[i].copy = my_strdup(av[i]);
25 1 result[i].word_array = my_str_to_word_array(av[i]);
26 }
27 2 result[i].length = 0;
28 2 result[i].str = 0;
29 2 result[i].copy = 0;
30 2 result[i].word_array = 0;
31 2 return result;
32 }
33