Skip to content

Commit

Permalink
contract: remove wee_alloc for more reliable mem alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
iwasaki-kenta committed Sep 7, 2019
1 parent d4fc881 commit f2a070f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion examples/token/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ impl Token {

Ok(())
}
}
}
26 changes: 0 additions & 26 deletions smart-contract/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![no_std]
#![feature(core_intrinsics, alloc_error_handler)]

extern crate alloc;
extern crate wee_alloc;

use alloc::fmt::{Debug, Formatter, Result};

Expand All @@ -11,30 +9,6 @@ pub mod payload;
pub mod sys;
pub mod transaction;

#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[cfg(feature = "no_std")]
#[panic_handler]
#[no_mangle]
pub fn panic(info: &core::panic::PanicInfo) -> ! {
let msg = info.payload().downcast_ref::<&str>().unwrap();

unsafe {
sys::_result(msg.as_ptr(), msg.len());
core::intrinsics::abort();
}
}

#[cfg(feature = "no_std")]
#[alloc_error_handler]
#[no_mangle]
pub fn oom(_: core::alloc::Layout) -> ! {
unsafe {
core::intrinsics::abort();
}
}

pub fn log(msg: &str) {
unsafe {
let msg = msg.as_bytes();
Expand Down

0 comments on commit f2a070f

Please sign in to comment.