18.2.158. PMIx_Envar_create
PMIx_Envar_create — Allocate and initialize an array of
pmix_envar_t(5) structures.
18.2.158.1. SYNOPSIS
#include <pmix.h>
pmix_envar_t* PMIx_Envar_create(size_t n);
18.2.158.1.1. Python Syntax
No Python equivalent
18.2.158.2. INPUT PARAMETERS
n: Number of pmix_envar_t(5) structures to allocate.
18.2.158.3. DESCRIPTION
Allocate a contiguous array of n pmix_envar_t
structures on the heap and construct each element (see
PMIx_Envar_construct(3)) so that every
envar and value pointer is NULL and every separator is
'\0'. A pointer to the first element of the array is returned.
If n is zero, no allocation is performed and NULL is returned.
18.2.158.4. RETURN VALUE
Returns a pointer to the newly allocated array of pmix_envar_t structures, or NULL if n is zero or the
allocation failed.
18.2.158.5. NOTES
An array obtained from PMIx_Envar_create must be released with
PMIx_Envar_free(3), which both destructs the
contents of each element and frees the array storage itself. Do not release
such an array element-by-element with PMIx_Envar_destruct(3), as that would leave the array storage leaked.
18.2.158.6. EXAMPLES
Create and later free an array:
pmix_envar_t *envars;
envars = PMIx_Envar_create(4);
/* ... use the array ... */
PMIx_Envar_free(envars, 4);