Skip to content

Commit 3afc172

Browse files
committed
Conditionally compile fn strlen
`strlen` is only used under certain feature flags, use `cfg` to conditionally build it in. Clears clippy warning.
1 parent 617bff9 commit 3afc172

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

secp256k1-sys/src/lib.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_3_1_default_error_callback_fn(message:
630630
panic!("[libsecp256k1] internal consistency check failed {}", msg);
631631
}
632632

633-
633+
#[no_mangle]
634+
#[cfg(not(feature = "external-symbols"))]
634635
unsafe fn strlen(mut str_ptr: *const c_char) -> usize {
635636
let mut ctr = 0;
636637
while *str_ptr != '\0' as c_char {
@@ -1161,11 +1162,13 @@ pub use self::fuzz_dummy::*;
11611162

11621163
#[cfg(test)]
11631164
mod tests {
1164-
use std::ffi::CString;
1165-
use super::strlen;
1166-
1165+
#[no_mangle]
1166+
#[cfg(not(feature = "external-symbols"))]
11671167
#[test]
11681168
fn test_strlen() {
1169+
use std::ffi::CString;
1170+
use super::strlen;
1171+
11691172
let orig = "test strlen \t \n";
11701173
let test = CString::new(orig).unwrap();
11711174

0 commit comments

Comments
 (0)