Conditionally compile fn strlen
`strlen` is only used under certain feature flags, use `cfg` to conditionally build it in. Clears clippy warning.
This commit is contained in:
parent
617bff9df3
commit
3afc172096
|
@ -630,7 +630,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_3_1_default_error_callback_fn(message:
|
||||||
panic!("[libsecp256k1] internal consistency check failed {}", msg);
|
panic!("[libsecp256k1] internal consistency check failed {}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
#[cfg(not(feature = "external-symbols"))]
|
||||||
unsafe fn strlen(mut str_ptr: *const c_char) -> usize {
|
unsafe fn strlen(mut str_ptr: *const c_char) -> usize {
|
||||||
let mut ctr = 0;
|
let mut ctr = 0;
|
||||||
while *str_ptr != '\0' as c_char {
|
while *str_ptr != '\0' as c_char {
|
||||||
|
@ -1161,11 +1162,13 @@ pub use self::fuzz_dummy::*;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#[no_mangle]
|
||||||
|
#[cfg(not(feature = "external-symbols"))]
|
||||||
|
#[test]
|
||||||
|
fn test_strlen() {
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use super::strlen;
|
use super::strlen;
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_strlen() {
|
|
||||||
let orig = "test strlen \t \n";
|
let orig = "test strlen \t \n";
|
||||||
let test = CString::new(orig).unwrap();
|
let test = CString::new(orig).unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue