NAME
genalloc_s, genalloc_len, genalloc_setlen - accessing genalloc data
SYNOPSIS
#include <limb/genalloc.h>
type *genalloc_s(type, genalloc *ga) size_t genalloc_len(type, genalloc *ga) void genalloc_setlen(type, genalloc *ga, int num)
DESCRIPTION
The genalloc_s
() macro returns a pointer to the data contained in genalloc
ga
, which must be elements of type type
. This macro is intended as a way to
access data stored inside a genalloc, allowing to read or write said data.
A typical way to access a specific element might be :
mytype *el = &genalloc_s(mytype, ga)[idx];
The genalloc_len
() macro returns the number of elements contained in genalloc
ga
, assuming it contains elements of of type type
.
The genalloc_setlen
() macro sets the used size of genalloc ga
to be that of
num
elements of type type
. Note that no checks are performed, it is up to
the caller of ensure the size set is valid. Much like when setting member len
of an stralloc.
RETURN VALUE
The genalloc_s
() macro returns a pointer to the data in genalloc ga
,
type-casted to type
.
The genalloc_len
() macro returns the number of elements of type type
in
genalloc ga
.