dte test coverage


Directory: ./
File: src/util/xmemrchr.c
Date: 2026-01-09 16:07:09
Coverage Exec Excl Total
Lines: 100.0% 2 0 2
Functions: 100.0% 1 0 1
Branches: 100.0% 2 0 2

Line Branch Exec Source
1 #include "build-defs.h"
2 #include <string.h>
3 #include "xmemrchr.h"
4
5 455 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 447 times.
✓ Branch 2 → 4 taken 8 times.
455 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