From 8c88c0b5aec90c24ab24d4a06fbd9011f94064e2 Mon Sep 17 00:00:00 2001 From: Able Date: Sun, 24 Nov 2024 12:43:15 -0600 Subject: [PATCH] defer in alloc --- STYLE_GUIDE.md | 4 +++- sysdata/programs/alloc_test/src/main.hb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 5f2e22242..17ed727fd 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -26,7 +26,9 @@ a := fn(): void {} ## Magic Numbers | loose The policy on magic numbers is make them const and have a comment above them. Typically linking to a source of information about the magic number. -This helps cut down on magic numbers while making acceptable names and atleast half assed documentation. +This helps cut down on magic numbers while making acceptable names and atleast half assed documentation. + +Constants are inlined anyways, so its the same thing in the binary. ```rust // The standard vga port is mapped at 0xB8000 diff --git a/sysdata/programs/alloc_test/src/main.hb b/sysdata/programs/alloc_test/src/main.hb index 67ed88451..479d1b412 100644 --- a/sysdata/programs/alloc_test/src/main.hb +++ b/sysdata/programs/alloc_test/src/main.hb @@ -15,6 +15,7 @@ main := fn(): void { // alloc.deinit() balloc := allocators.BlockAlloc.init() + defer balloc.deinit() bstruct := balloc.alloc(AStruct, 2) if bstruct.ptr == null { log.info("Hi\0") @@ -23,6 +24,5 @@ main := fn(): void { log.info("Allocator functioned.\0") } // balloc.dealloc(bstruct_ptr, AStruct, 2) - // balloc.deinit() return } \ No newline at end of file