From 2a6da1a7f379674ea8fedea7a5c282a4186ed449 Mon Sep 17 00:00:00 2001 From: emma Date: Thu, 23 Mar 2023 18:54:13 -0400 Subject: [PATCH] added GlobalAlloc --- Cargo.lock | 7 +++++++ Cargo.toml | 3 ++- src/lib.rs | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index d58b4a7..3d5404f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,6 +86,12 @@ version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +[[package]] +name = "libc_alloc" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a090348b66d90d8507e30f0d2bd88e5a5c454bd1733fc6d617cbc3471bf69ea" + [[package]] name = "libloading" version = "0.7.4" @@ -190,6 +196,7 @@ version = "0.0.2" dependencies = [ "bindgen", "libc", + "libc_alloc", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7c4d1a0..df01dcf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spd" -version = "0.0.2" +version = "0.0.3" edition = "2021" license = "LGPL-3.0-or-later" authors = [ @@ -13,6 +13,7 @@ repository = "https://git.tebibyte.media/emma/spd" [dependencies] libc = "0.2.140" +libc_alloc = "1.0.4" [build-dependencies] bindgen = "0.64.0" diff --git a/src/lib.rs b/src/lib.rs index 75d33c8..7ebd31b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,8 +73,13 @@ pub use libc_print as print; pub use libc_println as println; pub use libc_writeln as writeln; +pub use libc_alloc::LibcAlloc; + pub const SOURCE: &str = "https://git.tebibyte.media/emma/spd.git"; +#[global_allocator] +pub static ALLOCATOR: LibcAlloc = LibcAlloc; + #[panic_handler] pub fn panic(info: &panic::PanicInfo) -> ! { eprintln!("{:?}", info);