18.2.85. PMIx_Data_buffer_create

PMIx_Data_buffer_create — Allocate and initialize a new pmix_data_buffer_t structure.

18.2.85.1. SYNOPSIS

#include <pmix.h>

pmix_data_buffer_t* PMIx_Data_buffer_create(void);

18.2.85.2. DESCRIPTION

Allocate a new pmix_data_buffer_t on the heap and initialize it. The function allocates the structure and then zeroes it — exactly as PMIx_Data_buffer_construct(3) would — so the returned buffer is empty and ready for use with any pack, unpack, load, or unload operation. No data payload is attached.

Ownership of the returned structure passes to the caller. A buffer obtained from PMIx_Data_buffer_create must eventually be freed with PMIx_Data_buffer_release(3), which releases any payload the buffer holds and frees the structure itself. Do not free the returned pointer with a plain free(), and do not release it with PMIx_Data_buffer_destruct(3) alone (which would leak the structure).

18.2.85.3. RETURN VALUE

Returns a pointer to a newly allocated, initialized pmix_data_buffer_t on success. Returns NULL if the allocation failed.

18.2.85.4. NOTES

PMIx_Data_buffer_create is an OpenPMIx convenience routine. The Standard-defined interface for this operation is the PMIX_DATA_BUFFER_CREATE macro, which is implemented as an assignment from a call to this function.