Remove LLVMRustCoverageHashCString
Coverage has two FFI functions for computing the hash of a byte string. One takes a ptr/len pair, and the other takes a NUL-terminated C string. But on closer inspection, the C string version is unnecessary. The calling-side code converts a Rust `&str` into a C string, and the C++ code then immediately turns it back into a ptr/len string before actually hashing it.
This commit is contained in:
@@ -373,11 +373,6 @@ pub(crate) fn write_mapping_to_buffer(
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn hash_str(strval: &str) -> u64 {
|
||||
let strval = CString::new(strval).expect("null error converting hashable str to C string");
|
||||
unsafe { llvm::LLVMRustCoverageHashCString(strval.as_ptr()) }
|
||||
}
|
||||
|
||||
pub(crate) fn hash_bytes(bytes: &[u8]) -> u64 {
|
||||
unsafe { llvm::LLVMRustCoverageHashByteArray(bytes.as_ptr().cast(), bytes.len()) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user