% limb manual
% genalloc_s(3)
% limb 0.1.0
% 2023-07-24
# NAME
genalloc_s, genalloc_len, genalloc_setlen - accessing genalloc data
# SYNOPSIS
#include <limb/genalloc.h>
```pre hl
<em>type</em> *genalloc_s(<em>type</em>, genalloc *<em>ga</em>)
size_t genalloc_len(<em>type</em>, genalloc *<em>ga</em>)
void genalloc_setlen(<em>type</em>, genalloc *<em>ga</em>, int <em>num</em>)
```
# 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`.