diff --git a/src/header/strings/mod.rs b/src/header/strings/mod.rs index 35377ff8a2..6b017fe456 100644 --- a/src/header/strings/mod.rs +++ b/src/header/strings/mod.rs @@ -1,4 +1,6 @@ -//! strings implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/strings.h.html +//! `strings.h` implementation. +//! +//! See . // TODO: set this for entire crate when possible #![deny(unsafe_op_in_unsafe_fn)] @@ -15,11 +17,23 @@ use crate::{ platform::types::*, }; +/// See . +/// +/// # Deprecation +/// The `bcmp()` function was marked legacy in the Open Group Base +/// Specifications Issue 6, and removed in Issue 7. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn bcmp(first: *const c_void, second: *const c_void, n: size_t) -> c_int { unsafe { string::memcmp(first, second, n) } } +/// See . +/// +/// # Deprecation +/// The `bcopy()` function was marked legacy in the Open Group Base +/// Specifications Issue 6, and removed in Issue 7. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn bcopy(src: *const c_void, dst: *mut c_void, n: size_t) { unsafe { @@ -27,6 +41,12 @@ pub unsafe extern "C" fn bcopy(src: *const c_void, dst: *mut c_void, n: size_t) } } +/// See . +/// +/// # Deprecation +/// The `bzero()` function was marked legacy in the Open Group Base +/// Specifications Issue 6, and removed in Issue 7. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn bzero(dst: *mut c_void, n: size_t) { unsafe { @@ -34,6 +54,7 @@ pub unsafe extern "C" fn bzero(dst: *mut c_void, n: size_t) { } } +/// Non-POSIX, see . #[no_mangle] pub unsafe extern "C" fn explicit_bzero(s: *mut c_void, n: size_t) { for i in 0..n { @@ -46,6 +67,7 @@ pub unsafe extern "C" fn explicit_bzero(s: *mut c_void, n: size_t) { } } +/// See . #[no_mangle] pub extern "C" fn ffs(i: c_int) -> c_int { if i == 0 { @@ -54,16 +76,29 @@ pub extern "C" fn ffs(i: c_int) -> c_int { 1 + i.trailing_zeros() as c_int } +/// See . +/// +/// # Deprecation +/// The `index()` function was marked legacy in the Open Group Base +/// Specifications Issue 6, and removed in Issue 7. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn index(s: *const c_char, c: c_int) -> *mut c_char { unsafe { string::strchr(s, c) } } +/// See . +/// +/// # Deprecation +/// The `rindex()` function was marked legacy in the Open Group Base +/// Specifications Issue 6, and removed in Issue 7. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn rindex(s: *const c_char, c: c_int) -> *mut c_char { unsafe { string::strrchr(s, c) } } +/// See . #[no_mangle] pub unsafe extern "C" fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int { // SAFETY: the caller must ensure that s1 and s2 point to nul-terminated buffers. @@ -74,6 +109,7 @@ pub unsafe extern "C" fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_i inner_casecmp(zipped) } +/// See . #[no_mangle] pub unsafe extern "C" fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int { // SAFETY: the caller must ensure that s1 and s2 point to nul-terminated buffers.