% limb manual
% genalloc.h(0)
% limb 0.1.0
% 2023-07-24
# 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.
<inc skalibs.md>
## 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 :
: [genalloc_ready_tuned](3)
:: Ensure there's enough space in a *genalloc*.
: [genalloc_ready](3)
:: Ensure there's enough space in a *genalloc*.
: [genalloc_readyplus](3)
:: Ensure there's enough extra space in a *genalloc*.
: [genalloc_free](3)
:: Free memory associated with a *genalloc*.
: [genalloc_deepfree](3)
:: Free memory associated with a *genalloc*.
: [genalloc_deepfree_size](3)
:: Free memory associated with a *genalloc*.
: [genalloc_shrink](3)
:: Reduce memory usage to what's used.
: [genalloc_s](3)
:: Return a pointer to the data in a *genalloc*
: [genalloc_len](3)
:: Return the length/number of element in a *genalloc*
: [genalloc_setlen](3)
:: Set the length/number of element in a *genalloc*
: [genalloc_copyb](3)
:: Copy data into a *genalloc*.
: [genalloc_copy](3)
:: Copy content of a *genalloc* into another one.
: [genalloc_catb](3)
:: Append data into a *genalloc*.
: [genalloc_cat](3)
:: Append the content of a *genalloc* into another one.
: [genalloc_append](3)
:: Append a character into a *genalloc*.
: [genalloc_insertb](3)
:: Insert data into a *genalloc* at a specific offset.
: [genalloc_insert](3)
:: Insert the content of a *genalloc* into another one at a specific offset.
: [genalloc_qsort_full](3)
:: 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).
: [genalloc_remove](3)
:: Remove data from a *genalloc*.
: [genalloc_reverse](3)
:: Reverse the content of a *genalloc*.