18.2.94. PMIx_Value_create

PMIx_Value_create — Allocate and initialize an array of pmix_value_t(5) structures.

18.2.94.1. SYNOPSIS

#include <pmix.h>

pmix_value_t* PMIx_Value_create(size_t n);

18.2.94.1.1. Python Syntax

No Python equivalent

18.2.94.2. INPUT PARAMETERS

18.2.94.3. DESCRIPTION

Allocate a contiguous array of n pmix_value_t(5) structures on the heap and construct each element (zeroing it and setting its type to PMIX_UNDEF), exactly as PMIx_Value_construct(3) does for a single value.

The returned array is owned by the caller and must be released with PMIx_Value_free(3), passing the same count n, which destructs the contents of each element and frees the array storage.

18.2.94.4. RETURN VALUE

Returns a pointer to the newly allocated array of pmix_value_t(5) structures on success.

Returns NULL if n is zero or if the allocation fails.

18.2.94.5. NOTES

PMIx_Value_create is an OpenPMIx convenience routine. The corresponding macro-style interface for this operation is PMIX_VALUE_CREATE.

18.2.94.6. EXAMPLES

Create and later release an array of values:

pmix_value_t *array;

array = PMIx_Value_create(4);
if (NULL == array) {
    /* handle allocation failure */
}

/* ... use the array ... */

PMIx_Value_free(array, 4);