NAME
genalloc.h - general heap memory management
SYNOPSIS
#include <limb/genalloc.h>
DESCRIPTION
This header defines functions to work heap-allocated memory. It is implemented on top of stralloc (See stralloc.h(0) for more) providing an API to store dynamic arrays of fixed-size objects.
This header is a complement to skalibs' own header, intended to be used as a "replacement". However, instead of re-inventing the wheel, it depends/includes skalibs' header, and some of the functions below are actually implemented in skalibs, or macros to such functions.
Types
The following types are defined :
genalloc
A struct stralloc, as genalloc is implemented on top of stralloc
Objects
The following objects are defined :
genalloc_zero
An empty genalloc, which can be used for initialization.
Macros
The following macros are defined :
GENALLOC_ZERO
Value to initialize a stack-allocated genalloc.
Functions
The following functions/macros are defined :
Ensure there's enough space in a genalloc.
Ensure there's enough space in a genalloc.
Ensure there's enough extra space in a genalloc.
Free memory associated with a genalloc.
Free memory associated with a genalloc.
Free memory associated with a genalloc.
Reduce memory usage to what's used.
Return a pointer to the data in a genalloc
Return the length/number of element in a genalloc
Set the length/number of element in a genalloc
Copy data into a genalloc.
Copy content of a genalloc into another one.
Append data into a genalloc.
Append the content of a genalloc into another one.
Append a character into a genalloc.
Insert data into a genalloc at a specific offset.
Insert the content of a genalloc into another one at a specific offset.
Sort a section of a genalloc using qsort(3).
genalloc_qsort_r_full(3)
Similar to genalloc_qsort_full(3) but using qsort_r(3).
genalloc_qsort(3)
Sort a full genalloc using qsort(3).
genalloc_qsort_r(3)
Similar to genalloc_qsort(3) but using qsort_r(3).
Remove data from a genalloc.
Reverse the content of a genalloc.