added GlobalAlloc

This commit is contained in:
Emma Tebibyte 2023-03-23 18:54:13 -04:00
parent 3cb89896eb
commit 2a6da1a7f3
Signed by: emma
GPG Key ID: 6D661C738815E7DD
3 changed files with 14 additions and 1 deletions

7
Cargo.lock generated
View File

@ -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]]

View File

@ -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"

View File

@ -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);