| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2024 | ||
| 3 | ** my_memchr | ||
| 4 | ** File description: | ||
| 5 | ** The my_memchr.c | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "mymemory.h" | ||
| 9 | |||
| 10 | 3 | void *my_memchr(const void *memory_block, int searched_char, size_t size) | |
| 11 | { | ||
| 12 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if (memory_block == NULL) |
| 13 | 1 | return NULL; | |
| 14 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 times.
|
12 | for (size_t index = 0; index < size; index++) { |
| 15 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (((char *)memory_block)[index] == searched_char) |
| 16 | 1 | return (void *)&((char *)memory_block)[index]; | |
| 17 | } | ||
| 18 | 1 | return NULL; | |
| 19 | } | ||
| 20 |