diff --git a/melib/src/utils/datetime.rs b/melib/src/utils/datetime.rs index 3325f0ff..c79bdb3e 100644 --- a/melib/src/utils/datetime.rs +++ b/melib/src/utils/datetime.rs @@ -90,25 +90,23 @@ extern "C" { fn gettimeofday(tv: *mut libc::timeval, tz: *mut libc::timezone) -> i32; } -#[cfg(not(target_os = "openbsd"))] +#[cfg(target_os = "openbsd")] +const _LC_LAST: c_int = 7; +#[cfg(all(target_os = "openbsd", target_env = "musl"))] +const PLATFORM_ALL_MASK: i32 = 0x7fffffff; +#[cfg(all(target_os = "openbsd", not(target_env = "musl")))] +const PLATFORM_ALL_MASK: i32 = (1 << _LC_LAST) - 2; +#[cfg(all(not(target_os = "openbsd"), target_env = "musl"))] +const PLATFORM_ALL_MASK: i32 = 0x7fffffff; +#[cfg(all(not(target_os = "openbsd"), not(target_env = "musl")))] +const PLATFORM_ALL_MASK: i32 = libc::LC_ALL_MASK; + #[repr(i32)] #[derive(Clone, Copy)] #[allow(dead_code)] enum LocaleCategoryMask { Time = libc::LC_TIME_MASK, - All = libc::LC_ALL_MASK, -} - -#[cfg(target_os = "openbsd")] -const _LC_LAST: c_int = 7; - -#[cfg(target_os = "openbsd")] -#[repr(i32)] -#[derive(Clone, Copy)] -#[allow(dead_code)] -enum LocaleCategoryMask { - Time = 1 << libc::LC_TIME, - All = (1 << _LC_LAST) - 2, + All = PLATFORM_ALL_MASK, } #[repr(i32)]