Unsafe blocks: glob, inttypes, libgen

Related to #194.
This commit is contained in:
Josh Megnauth
2024-12-17 02:15:05 -05:00
parent 6fdcd4f44a
commit af7f5c4a3f
3 changed files with 77 additions and 49 deletions
+24 -18
View File
@@ -2,6 +2,8 @@
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/inttypes.h.html>.
#![deny(unsafe_op_in_unsafe_fn)]
use crate::{
header::{ctype, errno::*, stdlib::*},
platform::{self, types::*},
@@ -36,15 +38,17 @@ pub unsafe extern "C" fn strtoimax(
endptr: *mut *mut c_char,
base: c_int,
) -> intmax_t {
strto_impl!(
intmax_t,
false,
intmax_t::max_value(),
intmax_t::min_value(),
s,
endptr,
base
)
unsafe {
strto_impl!(
intmax_t,
false,
intmax_t::max_value(),
intmax_t::min_value(),
s,
endptr,
base
)
}
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoimax.html>.
@@ -54,15 +58,17 @@ pub unsafe extern "C" fn strtoumax(
endptr: *mut *mut c_char,
base: c_int,
) -> uintmax_t {
strto_impl!(
uintmax_t,
false,
uintmax_t::max_value(),
uintmax_t::min_value(),
s,
endptr,
base
)
unsafe {
strto_impl!(
uintmax_t,
false,
uintmax_t::max_value(),
uintmax_t::min_value(),
s,
endptr,
base
)
}
}
// wcstoimax(), wcstoumax() currently defined in header::wchar?