18.2.223. PMIx_Argv_copy
PMIx_Argv_copy — Produce a deep copy of a NULL-terminated
argv-style array.
18.2.223.1. SYNOPSIS
#include <pmix.h>
char **PMIx_Argv_copy(char **argv);
18.2.223.1.1. Python Syntax
No Python equivalent
18.2.223.2. INPUT PARAMETERS
argv: Pointer to a NULL-terminatedargv-style array, orNULL.
18.2.223.3. DESCRIPTION
Create and return an independent deep copy of argv. A new array is
allocated and each contained string is duplicated into it, so the copy shares
no storage with the original; modifying or freeing one array has no effect on
the other. The duplicated entries preserve the order and content of the
source, and the new array is NULL-terminated.
If argv points to a valid but empty array (its first element is
NULL), a valid empty array is returned rather than NULL.
The returned array and all of its strings are owned by the caller and must be released with PMIx_Argv_free(3).
18.2.223.4. RETURN VALUE
Returns a newly allocated NULL-terminated deep copy of the array. Returns
NULL if argv is NULL, or if an internal allocation fails during
the copy.
18.2.223.5. EXAMPLES
char **argv = PMIx_Argv_split("a:b:c", ':');
char **dup = PMIx_Argv_copy(argv);
PMIx_Argv_free(argv); /* dup remains valid */
PMIx_Argv_free(dup);