update safety comments

This commit is contained in:
Dustin J. Mitchell
2022-02-13 22:21:07 +00:00
parent ca904d6288
commit 8e34c107d5
7 changed files with 196 additions and 53 deletions

View File

@@ -61,7 +61,10 @@ pub unsafe extern "C" fn tc_server_new_local(
) -> *mut TCServer {
wrap(
|| {
// SAFETY: see TCString docstring
// SAFETY:
// - server_dir is not NULL (promised by caller)
// - server_dir is return from a tc_string_.. so is valid
// - caller will not use server_dir after this call (convention)
let server_dir = unsafe { TCString::take_from_ptr_arg(server_dir) };
let server_config = ServerConfig::Local {
server_dir: server_dir.to_path_buf(),