| 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 | 5 | void *my_memcpy(void *destination, const void *source, size_t size) | |
| 11 | { | ||
| 12 | 5 | char *ptr = destination; | |
| 13 | 5 | int end = 0; | |
| 14 | |||
| 15 |
3/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
5 | if (destination == NULL || source == NULL) |
| 16 | 1 | return NULL; | |
| 17 |
2/2✓ Branch 0 taken 50 times.
✓ Branch 1 taken 4 times.
|
54 | for (size_t index = 0; index < size; index++) { |
| 18 |
4/4✓ Branch 0 taken 27 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 25 times.
|
50 | if (end == 1 || ((char *)source)[index] == '\0') { |
| 19 | 25 | end = 1; | |
| 20 | 25 | ptr[index] = '\0'; | |
| 21 | } | ||
| 22 | 50 | ptr[index] = ((char *)source)[index]; | |
| 23 | } | ||
| 24 | 4 | return (void *)ptr; | |
| 25 | } | ||
| 26 |