dte test coverage


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 50.0% high: ≥ 85.0%
Coverage Exec / Excl / Total
Lines: 100.0% 2 / 0 / 2
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 2 / 0 / 2

src/util/xmemrchr.c
Line Branch Exec Source
1 #include "build-defs.h"
2 #include <string.h>
3 #include "xmemrchr.h"
4
5 456 void *xmemrchr(const void *ptr, int c, size_t n)
6 {
7 #if HAVE_MEMRCHR
8 // See also: the comment at the top of src/util/xstring.h
9
2/2
✓ Branch 2 → 3 taken 448 times.
✓ Branch 2 → 4 taken 8 times.
456 return likely(n) ? memrchr(ptr, c, n) : NULL;
10 #endif
11
12 for (const unsigned char *s = ptr; n--; ) {
13 if (s[n] == (unsigned char)c) {
14 return (void*)(s + n);
15 }
16 }
17
18 return NULL;
19 }
20