GCC Code Coverage Report


Directory: ./
File: s21_memchr.c
Date: 2025-07-13 17:59:14
Exec Total Coverage
Lines: 7 7 100.0%
Branches: 6 6 100.0%

Line Branch Exec Source
1 #include "s21_string.h"
2
3 6 void *s21_memchr(const void *str, int c, s21_size_t n) {
4 6 unsigned char *mas = (unsigned char *)str;
5 6 void *result = S21_NULL;
6
4/4
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 1 times.
18 for (s21_size_t i = 0; i < n && result == S21_NULL; i++) {
7
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 10 times.
12 if (mas[i] == c) {
8 2 result = mas + i;
9 }
10 }
11
12 6 return result;
13 }
14