18.2.132. PMIx_Pdata_create

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

18.2.132.1. SYNOPSIS

#include <pmix.h>

pmix_pdata_t* PMIx_Pdata_create(size_t n);

18.2.132.1.1. Python Syntax

No Python equivalent

18.2.132.2. INPUT PARAMETERS

18.2.132.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.

18.2.132.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.

18.2.132.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.

18.2.132.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);