./
Coverage:
low: ≥ 0%
medium: ≥ 50.0%
high: ≥ 80.0%
Lines:
9 / 10
90.0%
Branches:
5 / 8
62.5%
Functions:
1 / 1
100.0%

kfsw-services/src/parameter/libparam_compat.c
Line Branch Exec Source
1 #include <stddef.h>
2
3 402 size_t kfsw_libparam_strlcpy(char *destination, const char *source, size_t destination_size)
4 {
5 402 const char *cursor = source;
6 402 size_t copied = 0U;
7
8
1/2
✓ Branch 0 taken 402 times.
✗ Branch 1 not taken.
402 if (destination_size != 0U) {
9
3/4
✓ Branch 0 taken 536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 134 times.
✓ Branch 3 taken 402 times.
536 while ((copied + 1U < destination_size) && (*cursor != '\0')) {
10 134 destination[copied++] = *cursor++;
11 }
12 402 destination[copied] = '\0';
13 }
14
15
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 402 times.
402 while (*cursor != '\0') {
16 ✗ cursor++;
17 }
18
19 402 return (size_t)(cursor - source);
20 }
21