23.2.134. PMIx_Pdata_create

PMIx_Pdata_create — Allocate and initialize an array of pmix_pdata_t(5) structures.

23.2.134.1. SYNOPSIS

#include <pmix.h>

pmix_pdata_t* PMIx_Pdata_create(size_t n);

23.2.134.1.1. Python Syntax

No Python equivalent

23.2.134.2. INPUT PARAMETERS

23.2.134.3. DESCRIPTION

Allocate a contiguous array of n pmix_pdata_t structures on the heap and initialize each element as if by PMIx_Pdata_construct(3) — each element is zeroed and its value type set to PMIX_UNDEF.

The returned array is owned by the caller and must be released with PMIx_Pdata_free(3), which destructs each element and frees the array storage.

23.2.134.4. RETURN VALUE

Returns a pointer to the newly allocated array of pmix_pdata_t structures, or NULL if n is zero or the allocation fails.

23.2.134.5. NOTES

Because a request for zero elements returns NULL, callers should treat a NULL return as either an out-of-memory condition or a zero-length request, depending on the value passed for n.

23.2.134.6. EXAMPLES

Allocate and free an array:

pmix_pdata_t *array;

array = PMIx_Pdata_create(4);
/* ... populate and use array ... */
PMIx_Pdata_free(array, 4);