NAME

catgen_vecapp - append string to string array

SYNOPSIS

#include <cat/gen.h>

char **catgen_vecapp(char **vec, char *string);

void catgen_vecfree(char **vec);

DESCRIPTION

The function appends an allocated string to an array of strings, which may be reallocated. The array can start as a NULL array. The last element in the array must be a NULL pointer, and remains so to indicate the end of the array.

The string will become part of the array, and should not be freed or modified. As the vec argument may become reallocated, it should not be used again. Instead, use the return value from catgen_vecapp.

The vec can be freed using catgen_vecfree, which will deallocate the array and all the strings in it.

catgen_vecapp returns the NULL-terminated, possibly reallocated, array.