Allocate a 1-byte-aligned memory block from a buffer.
Declared in <bdlma_bufferimputil.h>
static
void*
allocateOneByteAlignedFromBuffer(
bsls::Types::IntPtr* cursor,
char* buffer,
bsls::Types::size_type bufferSize,
bsls::Types::size_type size);
Allocate a 1-byte-aligned memory block of the specified size (in bytes) from the specified buffer having the specified bufferSize (in bytes) at the specified cursor position. Return the address of the allocated memory block if buffer contains sufficient available memory, and 0 otherwise. The cursor is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless 0 < size, 0 <= *cursor, and *cursor <= bufferSize.
address of the allocated memory block if buffer contains sufficient available memory, and 0 otherwise
| Name | Description |
|---|---|
| cursor | byte offset into buffer at which to allocate |
| buffer | memory buffer from which to allocate |
| bufferSize | size in bytes of buffer |
| size | size in bytes of the memory block to allocate |