skalibs: the envalloc header
Keywords: skalibs header envalloc environ environment array stralloc dynamic heap

libstddjb
libskarnet
skalibs
Software
skarnet.org

# The `skalibs/envalloc.h` header

The following functions are declared in the `skalibs/env.h` header, and implemented in the `libskarnet.a` or `libskarnet.so` library.

## General information

`envalloc.h` is a supplement of `env.h` header that lets one use genallocs of `char const *` instead of fixed-size `char const *[]`.

## Functions

`int envalloc_uniq (genalloc *v, char delim)`
Removes strings in the v that share the same prefix up to the first delim character. For instance, if delim is `=`, duplicate environment variables are removed. Returns the number of removed entries on success, -1 (and sets errno) on failure.

`int envalloc_0 (genalloc *v)`
Appends a null pointer to v. Returns 1 on sucess, 0 (and sets errno) on failure.

`envalloc_make` and `envalloc_merge` work exactly like their `env.h` counterparts.