18.2.208. PMIx_Node_pid_create

PMIx_Node_pid_create — Allocate and initialize an array of pmix_node_pid_t(5) structures.

18.2.208.1. SYNOPSIS

#include <pmix.h>

pmix_node_pid_t* PMIx_Node_pid_create(size_t n);

18.2.208.1.1. Python Syntax

No Python equivalent

18.2.208.2. INPUT PARAMETERS

18.2.208.3. DESCRIPTION

Allocate a contiguous array of n pmix_node_pid_t structures on the heap and construct (initialize) each element as if by PMIx_Node_pid_construct(3).

If n is zero, the function returns NULL without allocating. If the underlying allocation fails, NULL is returned.

18.2.208.4. RETURN VALUE

Returns a pointer to the newly allocated, constructed array of pmix_node_pid_t structures, or NULL if n is zero or the allocation could not be satisfied.

18.2.208.5. NOTES

The returned array is owned by the caller and must be released with PMIx_Node_pid_free(3), passing the same count n that was used to create it. PMIx_Node_pid_free both destructs the contents of each element and frees the array storage itself.

18.2.208.6. EXAMPLES

Create and later free an array:

pmix_node_pid_t *array;

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

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

PMIx_Node_pid_free(array, 4);