NAME
sa_coloff - append an array of offsets to strings from an stralloc into it
SYNOPSIS
#include <limb/samisc.h>
int sa_coloff(stralloc *sa, size_t from, size_t skip, size_t end)
DESCRIPTION
The sa_coloff
() function will scan the content of the given stralloc sa
starting at offset from
, expecting to find a succession of NUL-terminated
strings after skip
bytes, up to end
. It will append into sa
an array of
offsets where each string is located within sa->s
(not accounting for skip
).
The offsets added into sa
are actually casted as uintptr_t so that they
can later be turned into full string pointers (char *) if needed.
Such a conversion can be done using sa_off2ptr(3) if skip
is 0.
RETURN VALUE
Upon successful completion, the sa_coloff
() function returns the number of
strings found, or the number of elements in the array. Otherwise, it returns -1
and sets errno
to indicate the error.
ERRORS
The sa_coloff
() function may fail if :
ENOMEM
Out of memory to add pointers into sa