|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Thin, MISRA-visible wrappers over the three raw memory-block primitives (fill/copy/compare) every other Platform_RTE or downstream-application module needs but has no business calling libc's <string.h> directly for - rte_mem_set()/rte_mem_copy()/ rte_mem_compare() are the ONE sanctioned call site for each underlying libc function, so an audit for "does this codebase call libc string/memory functions directly" has exactly one file to check instead of grepping every translation unit for <string.h>. Deliberately NOT a "safe string library" (no strcpy/strcat/strlen-style variable-length text handling) - this framework and every application built on it work in fixed-size buffers throughout (CLAUDE.md: no malloc/free), so the only primitives actually needed are fixed-length block operations. More...
#include <stddef.h>#include <string.h>Go to the source code of this file.
Functions | |
| static void | rte_mem_set (void *dest, int value, size_t count) |
Fills count bytes starting at dest with value - the one sanctioned call site for libc memset() in this framework (see this file's own doc). | |
| static void | rte_mem_copy (void *dest, const void *src, size_t count) |
Copies count bytes from src to dest - the one sanctioned call site for libc memcpy() in this framework (see this file's own doc). | |
| static int | rte_mem_compare (const void *a, const void *b, size_t count) |
Byte-for-byte compares count bytes of a against b - the one sanctioned call site for libc memcmp() in this framework (see this file's own doc). | |
Thin, MISRA-visible wrappers over the three raw memory-block primitives (fill/copy/compare) every other Platform_RTE or downstream-application module needs but has no business calling libc's <string.h> directly for - rte_mem_set()/rte_mem_copy()/ rte_mem_compare() are the ONE sanctioned call site for each underlying libc function, so an audit for "does this codebase call libc string/memory functions directly" has exactly one file to check instead of grepping every translation unit for <string.h>. Deliberately NOT a "safe string library" (no strcpy/strcat/strlen-style variable-length text handling) - this framework and every application built on it work in fixed-size buffers throughout (CLAUDE.md: no malloc/free), so the only primitives actually needed are fixed-length block operations.
static inline, header-only, no OSAdapter/.c file: these are trivial, stateless wrappers with no OS dependency at all (unlike the seven real OAL services - rte_timer, rte_nvm, rte_memory, etc. - see rte_appmanager.h's own note on that distinction) - same convention as rte_notify.h's RTE_DECLARE_CALLBACK_LIST (ADR-030).
Definition in file rte_mem_util.h.
|
inlinestatic |
Fills count bytes starting at dest with value - the one sanctioned call site for libc memset() in this framework (see this file's own doc).
| dest | Caller-owned storage, at least count bytes. Must not be NULL unless count is 0. |
| value | Byte value to write, same truncation-to-unsigned-char convention as memset() itself. |
| count | Number of bytes to fill; 0 is a no-op. |
Definition at line 39 of file rte_mem_util.h.
|
inlinestatic |
Copies count bytes from src to dest - the one sanctioned call site for libc memcpy() in this framework (see this file's own doc).
| dest | Destination, caller-owned, at least count bytes. Must not be NULL unless count is 0. |
| src | Source, caller-owned, at least count bytes. Must not overlap dest (same contract as memcpy() itself - use a genuinely overlap-safe primitive instead if that is ever needed; none is provided here since nothing in this codebase currently copies overlapping ranges). Must not be NULL unless count is 0. |
| count | Number of bytes to copy; 0 is a no-op. |
Definition at line 56 of file rte_mem_util.h.
|
inlinestatic |
Byte-for-byte compares count bytes of a against b - the one sanctioned call site for libc memcmp() in this framework (see this file's own doc).
| a,b | Caller-owned, at least count bytes each. Must not be NULL unless count is 0. |
| count | Number of bytes to compare; 0 always returns 0. |
Definition at line 70 of file rte_mem_util.h.