+3
-1
src/header/string/mod.rs
+3
-1
src/header/string/mod.rs
···
423
423
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strlen.html>.
424
424
#[unsafe(no_mangle)]
425
425
pub unsafe extern "C" fn strlen(s: *const c_char) -> size_t {
426
-
unsafe { NulTerminated::new(s).unwrap() }.count()
426
+
unsafe { NulTerminated::new(s) }
427
+
.map(|s| s.count())
428
+
.unwrap_or(0)
427
429
}
428
430
429
431
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncat.html>.