GCC Code Coverage Report


Directory: ./
File: lib/mylist/my_push_back.c
Date: 2024-06-05 02:24:39
Exec Total Coverage
Lines: 0 14 0.0%
Functions: 0 1 0.0%
Branches: 0 4 0.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** my_push_back
4 ** File description:
5 ** Adds a node at the end of a linked list
6 */
7
8 #include "mylist.h"
9
10 ✗ void my_push_back(linked_list_t **begin, void *data, type_t type)
11 {
12 ✗ linked_list_t *new = malloc(sizeof(linked_list_t));
13 ✗ linked_list_t *tmp = *begin;
14
15 ✗ new->data = data;
16 ✗ new->type = type;
17 ✗ new->next = NULL;
18 ✗ if (*begin == NULL) {
19 ✗ new->prev = NULL;
20 ✗ *begin = new;
21 ✗ return;
22 }
23 ✗ while (tmp->next != NULL)
24 ✗ tmp = tmp->next;
25 ✗ tmp->next = new;
26 ✗ new->prev = tmp;
27 }
28