GCC Code Coverage Report


Directory: ./
File: lib/mymemory/my_memchr.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 1 1 100.0%
Branches: 6 6 100.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2024
3 ** my_memchr
4 ** File description:
5 ** Searches for the first occurrence of the character (c)
6 ** in the first (n) bytes of the string (s)
7 */
8 /**
9 * @file my_memchr.c
10 * @brief The file containing the my_memchr function
11 * @author Nicolas TORO
12 */
13
14 #include "mymemory.h"
15
16 3 void *my_memchr(const void *memory_block, int searched_char, size_t size)
17 {
18
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
3 if (memory_block == NULL)
19 1 return NULL;
20
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 times.
12 for (size_t index = 0; index < size; index++) {
21
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
11 if (((char *)memory_block)[index] == searched_char)
22 1 return (void *)&((char *)memory_block)[index];
23 }
24 1 return NULL;
25 }
26