library: Remove definitions and reexports of strlen
from libstd
This commit is contained in:
parent
afa2e6f2ff
commit
6eaec56ef7
@ -71,16 +71,6 @@ pub fn unsupported_err() -> crate::io::Error {
|
||||
)
|
||||
}
|
||||
|
||||
pub unsafe fn strlen(start: *const c_char) -> usize {
|
||||
let mut str = start;
|
||||
|
||||
while *str != 0 {
|
||||
str = str.offset(1);
|
||||
}
|
||||
|
||||
(str as usize) - (start as usize)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn floor(x: f64) -> f64 {
|
||||
unsafe { intrinsics::floorf64(x) }
|
||||
|
@ -5,7 +5,6 @@
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
use crate::io::ErrorKind;
|
||||
use crate::os::raw::c_char;
|
||||
use crate::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
pub mod abi;
|
||||
@ -130,15 +129,6 @@ pub fn decode_error_kind(code: i32) -> ErrorKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn strlen(mut s: *const c_char) -> usize {
|
||||
let mut n = 0;
|
||||
while unsafe { *s } != 0 {
|
||||
n += 1;
|
||||
s = unsafe { s.offset(1) };
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
pub fn abort_internal() -> ! {
|
||||
abi::usercalls::exit(true)
|
||||
}
|
||||
|
@ -99,5 +99,3 @@ pub fn hashmap_random_keys() -> (u64, u64) {
|
||||
(x1, x2)
|
||||
}
|
||||
}
|
||||
|
||||
pub use libc::strlen;
|
||||
|
@ -3,7 +3,6 @@
|
||||
use crate::io::ErrorKind;
|
||||
|
||||
pub use self::rand::hashmap_random_keys;
|
||||
pub use libc::strlen;
|
||||
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
#[macro_use]
|
||||
|
@ -4,10 +4,6 @@ pub mod memchr {
|
||||
pub use core::slice::memchr::{memchr, memrchr};
|
||||
}
|
||||
|
||||
// This is not necessarily correct. May want to consider making it part of the
|
||||
// spec definition?
|
||||
use crate::os::raw::c_char;
|
||||
|
||||
// SAFETY: must be called only once during runtime initialization.
|
||||
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
|
||||
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
|
||||
@ -38,15 +34,3 @@ pub fn abort_internal() -> ! {
|
||||
pub fn hashmap_random_keys() -> (u64, u64) {
|
||||
(1, 2)
|
||||
}
|
||||
|
||||
pub unsafe fn strlen(mut s: *const c_char) -> usize {
|
||||
// SAFETY: The caller must guarantee `s` points to a valid 0-terminated string.
|
||||
unsafe {
|
||||
let mut n = 0;
|
||||
while *s != 0 {
|
||||
n += 1;
|
||||
s = s.offset(1);
|
||||
}
|
||||
n
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ use crate::path::PathBuf;
|
||||
use crate::time::Duration;
|
||||
|
||||
pub use self::rand::hashmap_random_keys;
|
||||
pub use libc::strlen;
|
||||
|
||||
#[macro_use]
|
||||
pub mod compat;
|
||||
|
Loading…
x
Reference in New Issue
Block a user