18.2.175. PMIx_Byte_object_create

PMIx_Byte_object_create — Allocate and initialize an array of pmix_byte_object_t(5) structures.

18.2.175.1. SYNOPSIS

#include <pmix.h>

pmix_byte_object_t* PMIx_Byte_object_create(size_t n);

18.2.175.1.1. Python Syntax

No Python equivalent

18.2.175.2. INPUT PARAMETERS

18.2.175.3. DESCRIPTION

Allocate a contiguous array of n pmix_byte_object_t structures on the heap and construct each element (setting its bytes pointer to NULL and its size to zero).

If n is zero, no allocation is performed and NULL is returned.

18.2.175.4. RETURN VALUE

Returns a pointer to the newly allocated and initialized array, or NULL if n is zero or the allocation fails.

18.2.175.5. NOTES

An array obtained from PMIx_Byte_object_create must be released with PMIx_Byte_object_free(3), which destructs every element’s payload and frees the array storage itself. Passing the same count n used at creation is required.

The convenience macro PMIX_BYTE_OBJECT_CREATE is provided as a wrapper around this function.

18.2.175.6. EXAMPLES

Create and later release an array of byte objects:

pmix_byte_object_t *array;

array = PMIx_Byte_object_create(4);
/* ... populate and use the objects ... */
PMIx_Byte_object_free(array, 4);