Function rcutils_uint8_array_resize

Function Documentation

rcutils_ret_t rcutils_uint8_array_resize(rcutils_uint8_array_t *uint8_array, size_t new_size)

Resize the internal buffer of the uint8 array.

The internal buffer of the uint8 array can be resized dynamically if needed. If the new size is smaller than the current capacity, then the memory is truncated. Be aware, that this might deallocate the memory and therefore invalidates any pointers to this storage.

Parameters:
  • uint8_array[inout] pointer to the instance of rcutils_uint8_array_t which is being resized

  • new_size[in] the new size of the internal buffer

Returns:

RCUTILS_RET_OK if successful, or

Returns:

RCUTILS_RET_INVALID_ARGUMENT if new_size is set to zero

Returns:

RCUTILS_RET_BAD_ALLOC if memory allocation failed, or

Returns:

RCUTILS_RET_ERROR if an unexpected error occurs.