Function libyml::api::yaml_strdup

source ·
pub unsafe fn yaml_strdup(str: *const u8) -> *mut u8
Expand description

Duplicate a string using the system’s strdup function.

This function is a thin wrapper around the system’s strdup function, used for string duplication within the LibYML crate.

§Safety

  • This function is unsafe because it directly calls the system’s strdup function, which can lead to undefined behaviour if misused.
  • The caller must ensure that the provided str is either a valid pointer to a null-terminated string, or a null pointer.
  • If str is a null pointer, this function returns a null pointer.
  • The caller is responsible for properly freeing the duplicated string using the corresponding yaml_free function when it is no longer needed.