18.2.83. PMIx_Data_buffer_construct

PMIx_Data_buffer_construct — Initialize a caller-provided pmix_data_buffer_t structure.

18.2.83.1. SYNOPSIS

#include <pmix.h>

void PMIx_Data_buffer_construct(pmix_data_buffer_t *b);

18.2.83.2. INPUT PARAMETERS

  • b: Pointer to the pmix_data_buffer_t structure to be initialized. The storage for the structure itself must already exist — it is supplied by the caller (typically declared on the stack or embedded within another object).

18.2.83.3. DESCRIPTION

Initialize the memory of a pmix_data_buffer_t that the caller has already allocated. The function simply zeroes the entire structure, clearing the internal base_ptr, pack_ptr, and unpack_ptr pointers and setting bytes_allocated and bytes_used to zero. No heap memory is allocated, and no data payload is attached.

A buffer must be constructed (or created with PMIx_Data_buffer_create(3)) before it is passed to any pack, unpack, load, or unload operation; using an uninitialized buffer produces undefined behavior.

Because PMIx_Data_buffer_construct operates on caller-provided storage, it must be paired with PMIx_Data_buffer_destruct(3) to release any payload the buffer subsequently acquires. Do not pass a constructed (as opposed to created) buffer to PMIx_Data_buffer_release(3), as that would attempt to free storage the library did not allocate.

18.2.83.4. RETURN VALUE

PMIx_Data_buffer_construct returns no value (void).

18.2.83.5. NOTES

PMIx_Data_buffer_construct is an OpenPMIx convenience routine. The Standard-defined interface for this operation is the PMIX_DATA_BUFFER_CONSTRUCT macro, which is implemented as a direct call to this function.