Scroll to navigation

PMIX_ENVAR_CREATE(3) OpenPMIx PMIX_ENVAR_CREATE(3)

PMIx_Envar_create — Allocate and initialize an array of pmix_envar_t(5) <#man5-pmix-envar-t> structures.

SYNOPSIS

#include <pmix.h>
pmix_envar_t* PMIx_Envar_create(size_t n);


Python Syntax

No Python equivalent

INPUT PARAMETERS

•
n: Number of pmix_envar_t(5) <#man5-pmix-envar-t> structures to allocate.

DESCRIPTION

Allocate a contiguous array of n pmix_envar_t <#man5-pmix-envar-t> structures on the heap and construct each element (see PMIx_Envar_construct(3) <#man3-pmix-envar-construct>) 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.

RETURN VALUE

Returns a pointer to the newly allocated array of pmix_envar_t <#man5-pmix-envar-t> structures, or NULL if n is zero or the allocation failed.

NOTES

An array obtained from PMIx_Envar_create must be released with PMIx_Envar_free(3) <#man3-pmix-envar-free>, 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) <#man3-pmix-envar-destruct>, as that would leave the array storage leaked.

EXAMPLES

Create and later free an array:

pmix_envar_t *envars;
envars = PMIx_Envar_create(4);
/* ... use the array ... */
PMIx_Envar_free(envars, 4);


See also:

PMIx_Envar_free(3) <#man3-pmix-envar-free>, PMIx_Envar_construct(3) <#man3-pmix-envar-construct>, PMIx_Envar_destruct(3) <#man3-pmix-envar-destruct>, PMIx_Envar_load(3) <#man3-pmix-envar-load>, pmix_envar_t(5) <#man5-pmix-envar-t>


Copyright

2014-2026, OpenPMIx Community

September 27, 2026