Mbed OS Reference
Loading...
Searching...
No Matches
QCBORStringAllocator Struct Reference

This is a set of functions and pointer context (in object-oriented parlance, an "object") used to allocate memory for coalescing the segments of an indefinite length string into one. More...

#include <qcbor.h>

Detailed Description

This is a set of functions and pointer context (in object-oriented parlance, an "object") used to allocate memory for coalescing the segments of an indefinite length string into one.

The fAllocate function works as an initial allocator and a reallocator to expand the string for each new segment. When it is an initial allocator pOldMem is NULL.

The fFree function is called to clean up an individual allocation when an error occurs.

The fDesctructor function is called when QCBORDecode_Finish is called.

Any memory allocated with this will be marked by setting uDataAlloc or uLabelAlloc in the QCBORItem structure so the caller knows they have to free it.

fAllocate is only ever called to increase the single most recent allocation made, making implementation of a memory pool very simple.

fFree is also only called on the single most recent allocation.

Definition at line 784 of file qcbor.h.