18.2.164. PMIx_Query_create

PMIx_Query_create — Allocate and initialize an array of pmix_query_t(5) structures.

18.2.164.1. SYNOPSIS

#include <pmix.h>

pmix_query_t* PMIx_Query_create(size_t n);

18.2.164.1.1. Python Syntax

No Python equivalent

18.2.164.2. INPUT PARAMETERS

18.2.164.3. DESCRIPTION

Allocate a contiguous array of n pmix_query_t structures on the heap and initialize each element by calling PMIx_Query_construct(3) on it. The returned array is owned by the caller and must eventually be released with PMIx_Query_free(3) (passing the same count n) or, for a single-element array, with PMIx_Query_release(3).

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

18.2.164.4. RETURN VALUE

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

18.2.164.5. NOTES

The PMIX_QUERY_CREATE convenience macro is a direct wrapper for this function; it assigns the returned pointer to its first argument.

18.2.164.6. EXAMPLES

Create and later free an array of query structures:

pmix_query_t *queries;

queries = PMIx_Query_create(2);
/* ... populate queries[0], queries[1] ... */
PMIx_Query_free(queries, 2);