18.2.220. PMIx_Argv_free

PMIx_Argv_free — Release a NULL-terminated argv-style array and all of the strings it contains.

18.2.220.1. SYNOPSIS

#include <pmix.h>

void PMIx_Argv_free(char **argv);

18.2.220.1.1. Python Syntax

No Python equivalent

18.2.220.2. INPUT PARAMETERS

  • argv: Pointer to a NULL-terminated argv-style array, or NULL.

18.2.220.3. DESCRIPTION

Free every string in the array argv and then free the array itself. The routine walks the array from its first element to the terminating NULL, releasing each contained string, and finally releases the block that holds the pointers.

PMIx_Argv_free is the correct disposal routine for any array produced or grown by the PMIx_Argv_* family — PMIx_Argv_append_nosize(3), PMIx_Argv_prepend_nosize(3), PMIx_Argv_append_unique_nosize(3), PMIx_Argv_split(3), PMIx_Argv_split_with_empty(3), PMIx_Argv_split_inter(3), and PMIx_Argv_copy(3) — because those routines allocate both the array and the strings it holds.

Passing NULL is safe and does nothing. After the call the array pointer is invalid and must not be reused.

18.2.220.4. RETURN VALUE

PMIx_Argv_free returns no value (void).

18.2.220.5. NOTES

Do not use PMIx_Argv_free on an array whose strings were not allocated by the library (for example, a stack array of string literals); doing so passes non-heap pointers to free and produces undefined behavior.