Skip to content

Commit

Permalink
apply fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankurte committed Aug 19, 2024
1 parent 036ecd1 commit a808328
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ledger_secure_sdk_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![allow(non_snake_case)]

use core::ffi::c_void;
#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
use core::mem::MaybeUninit;

pub mod buttons;
Expand Down Expand Up @@ -35,22 +35,22 @@ pub fn pic_rs_mut<T>(x: &mut T) -> &mut T {
unsafe { &mut *ptr }
}

#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
use critical_section::RawRestoreState;
#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
use embedded_alloc::Heap;

#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
#[global_allocator]
static HEAP: Heap = Heap::empty();

#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
struct CriticalSection;
#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
critical_section::set_impl!(CriticalSection);

/// Default empty implementation as we don't have concurrency.
#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
unsafe impl critical_section::Impl for CriticalSection {
unsafe fn acquire() -> RawRestoreState {}
unsafe fn release(_restore_state: RawRestoreState) {}
Expand All @@ -61,15 +61,15 @@ unsafe impl critical_section::Impl for CriticalSection {
/// The heap is stored in the stack, and has a fixed size.
/// This method is called just before [sample_main].
#[no_mangle]
#[cfg(all(feature = "heap", not(target_os="nanos")))]
#[cfg(all(feature = "heap", not(target_os = "nanos")))]
extern "C" fn heap_init() {
const HEAP_SIZE: usize = 1024;
static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE];
unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) }
}

#[no_mangle]
#[cfg(any(not(feature = "heap"), target_os="nanos"))]
#[cfg(any(not(feature = "heap"), target_os = "nanos"))]
extern "C" fn heap_init() {}

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

0 comments on commit a808328

Please sign in to comment.