Skip to content

Commit

Permalink
Remove usages of deprecated ATOMIC_USIZE_INIT (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbool authored and SSheldon committed Apr 7, 2019
1 parent 4f8f67a commit fa7ca43
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ macro_rules! class {
#[inline(always)]
fn get_class(name: &str) -> Option<&'static $crate::runtime::Class> {
unsafe {
#[cfg_attr(feature = "cargo-clippy", allow(replace_consts))]
static CLASS: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
static CLASS: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0);
// `Relaxed` should be fine since `objc_getClass` is thread-safe.
let ptr = CLASS.load(::std::sync::atomic::Ordering::Relaxed) as *const $crate::runtime::Class;
if ptr.is_null() {
Expand Down Expand Up @@ -49,8 +48,7 @@ macro_rules! sel_impl {
#[inline(always)]
fn register_sel(name: &str) -> $crate::runtime::Sel {
unsafe {
#[cfg_attr(feature = "cargo-clippy", allow(replace_consts))]
static SEL: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
static SEL: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0);
let ptr = SEL.load(::std::sync::atomic::Ordering::Relaxed) as *const ::std::os::raw::c_void;
// It should be fine to use `Relaxed` ordering here because `sel_registerName` is
// thread-safe.
Expand Down

0 comments on commit fa7ca43

Please sign in to comment.