Function rcutils_uint8_array_fini

Function Documentation

rcutils_ret_t rcutils_uint8_array_fini(rcutils_uint8_array_t *uint8_array)

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.

rcutils_ret_t

rcutils_uint8_array_init(

rcutils_uint8_array_t * uint8_array,

size_t buffer_capacity,

const rcutils_allocator_t * allocator);

Finalize a uint8 array struct. /** Cleans up and deallocates any resources used in a rcutils_uint8_array_t. The array passed to this function needs to have been initialized by rcutils_uint8_array_init(). Passing an uninitialized instance to this function leads to undefined behavior.

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

  • uint8_array[in] pointer to the rcutils_uint8_array_t to be cleaned up

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. */

Returns:

RCUTILS_RET_OK if successful, or

Returns:

RCUTILS_RET_INVALID_ARGUMENT if the uint8_array argument is invalid

Returns:

RCUTILS_RET_ERROR if an unexpected error occurs.