LCOV - code coverage report
Current view: top level - AP_HAL/utility - replace.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 6 6 100.0 %
Date: 2026-09-09 11:02:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :   replacement functions for systems that are missing required library functions
       3             :  */
       4             : 
       5             : #include "replace.h"
       6             : 
       7             : #ifndef HAVE_MEMRCHR
       8             : /*
       9             :   replacement for memrchr(). Note that we make the buffer non-const to
      10             :   avoid issues with converting const to non-const
      11             :  */
      12          18 : void *replace_memrchr(void *s, int c, size_t n)
      13             : {
      14          18 :     uint8_t *b = (uint8_t *)s;
      15          58 :     for (int32_t i=n-1; i>=0; i--) {
      16          52 :         if (b[i] == (uint8_t)c) {
      17          12 :             return (void *)&b[i];
      18             :         }
      19             :     }
      20           6 :     return nullptr;
      21             : }
      22             : #endif

Generated by: LCOV version 1.14