Function rcutils_strdup

Function Documentation

char *rcutils_strdup(const char *str, rcutils_allocator_t allocator)

Return a duplicated string with an allocator, or null if an error occurs.

This function is identical to rcutils_strndup() except the length of the c string does not have to be given and therefore the c string must be null terminated.

Parameters:
  • str[in] null terminated c string to be duplicated

  • allocator[in] the allocator to use for allocation

Returns:

duplicated string, or

Returns:

NULL if there is an error.