MMgr v2.3.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches

A buffer under fill: its bytes, how far the writer went, and whether it ran out. More...

#include <spatium.h>

Data Fields

uint8_t * buf
size_t cap
size_t pos
embed_bool overflow

Detailed Description

A buffer under fill: its bytes, how far the writer went, and whether it ran out.

Note
Returned by value. This module retains no span of its own.
overflow is sticky. Once a write runs past cap it stays set, and only mmgr_spat_reset clears it.
To reach it at all is a build failure. So a read of it finds out that something is wrong and does not decide what to do next. It latches so that a wrong program stops its writes and does not walk off the end. It also latches so that one test after a run of appends catches it.
Warning
buf points at the caller's storage, which must outlive every use of the span [BORROWS].

Definition at line 50 of file spatium.h.

Field Documentation

◆ buf

uint8_t* mmgr_span::buf

The buffer the span covers [BORROWS].

Definition at line 52 of file spatium.h.

◆ cap

size_t mmgr_span::cap

Bytes in buf.

Definition at line 53 of file spatium.h.

◆ pos

size_t mmgr_span::pos

Bytes written so far, which mmgr_spat_from sets to 0.

Definition at line 54 of file spatium.h.

◆ overflow

embed_bool mmgr_span::overflow

Set once a write runs past cap, and only mmgr_spat_reset clears it.

Definition at line 55 of file spatium.h.


The documentation for this struct was generated from the following file: