| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2024 | ||
| 3 | ** my_memmove | ||
| 4 | ** File description: | ||
| 5 | ** The my_memmove.c | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "mymemory.h" | ||
| 9 | |||
| 10 | 4 | void *my_memmove(void *destination, const void *source, size_t size) | |
| 11 | { | ||
| 12 | 4 | char *ptr = destination; | |
| 13 | 4 | int end = 0; | |
| 14 | |||
| 15 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
4 | if (destination == NULL || source == NULL) |
| 16 | 1 | return NULL; | |
| 17 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 3 times.
|
33 | for (size_t index = 0; index < size; index++) { |
| 18 |
4/4✓ Branch 0 taken 26 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 25 times.
|
30 | if (end == 1 || ((char *)source)[index] == '\0') { |
| 19 | 5 | end = 1; | |
| 20 | 5 | ptr[index] = '\0'; | |
| 21 | } | ||
| 22 | 30 | ptr[index] = ((char *)source)[index]; | |
| 23 | } | ||
| 24 | 3 | return (void *)ptr; | |
| 25 | } | ||
| 26 |