Function rcutils_uint8_array_init
Defined in File uint8_array.h
Function Documentation
-
rcutils_ret_t rcutils_uint8_array_init(rcutils_uint8_array_t *uint8_array, size_t buffer_capacity, const rcutils_allocator_t *allocator)
Initialize a zero initialized uint8 array struct.
This function may leak if the uint8 array struct is already initialized. If the capacity is set to 0, no memory is allocated and the internal buffer is still NULL.
- Parameters:
uint8_array – [inout] a pointer to the to be initialized uint8 array struct
buffer_capacity – [in] the size of the memory to allocate for the byte stream
allocator – [in] the allocator to use for the memory allocation
- Returns:
RCUTILS_RET_OK if successful, or
- Returns:
RCUTILS_RET_INVALID_ARGUMENT if any arguments are invalid, or
- Returns:
‘RCUTILS_RET_BAD_ALLOC` if no memory could be allocated correctly
- Returns:
RCUTILS_RET_ERROR if an unexpected error occurs.