defer in alloc
This commit is contained in:
parent
8b2b50e433
commit
8c88c0b5ae
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue