18.2.217. PMIx_Regex2_create

PMIx_Regex2_create — Allocate and initialize an array of pmix_regex2_t(5) structures.

18.2.217.1. SYNOPSIS

#include <pmix.h>

pmix_regex2_t* PMIx_Regex2_create(size_t n);

18.2.217.1.1. Python Syntax

No Python equivalent

18.2.217.2. INPUT PARAMETERS

  • n: Number of pmix_regex2_t structures to allocate.

18.2.217.3. DESCRIPTION

Allocate a contiguous array of n pmix_regex2_t structures on the heap and construct each element (see PMIx_Regex2_construct(3)) so that every type and bytes pointer is NULL and every len is zero. A pointer to the first element of the array is returned.

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

18.2.217.4. RETURN VALUE

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

18.2.217.5. NOTES

An array obtained from PMIx_Regex2_create must be released with PMIx_Regex2_free(3), which both destructs the contents of each element and frees the array storage itself. Do not release such an array element-by-element with PMIx_Regex2_destruct(3), as that would leave the array storage leaked.

18.2.217.6. EXAMPLES

Create and later free an array:

pmix_regex2_t *rex;

rex = PMIx_Regex2_create(2);

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

PMIx_Regex2_free(rex, 2);