formatted license comment

This commit is contained in:
Lorenzo Torres 2025-11-04 00:00:52 +01:00
parent db5a728846
commit 0ffdb8c3ac
30 changed files with 16218 additions and 14914 deletions

View file

@ -1,15 +1,13 @@
// SPDX-License-Identifier: BSD-3-Clause
/* SPDX-License-Identifier:BSD-3-Clause */
#ifndef ARENA_H
#define ARENA_H
#include "../types.h"
/*
* An arena is a fast allocator that just
* keeps everything in a contiguous chunk
* of memory and moves a "pointer" when
* allocating new memory. The allocated
* memory is then free'd all at once.
* An arena is a fast allocator that just keeps everything in a contiguous
* chunk of memory and moves a "pointer" when allocating new memory. The
* allocated memory is then free'd all at once.
*/
struct arena_allocator {
usize size;
@ -25,19 +23,16 @@ struct arena_allocator *arena_init(usize size);
void arena_deinit(struct arena_allocator *allocator);
/*
* Allocate a chunk of memory of size `size` on the
* arena.
* Allocate a chunk of memory of size `size` on the arena.
*/
void *arena_alloc(struct arena_allocator *allocator, usize size);
/*
* Same as `arena_alloc()` but also set all the allocated
* memory to zero.
* Same as `arena_alloc()` but also set all the allocated memory to zero.
*/
void *arena_zalloc(struct arena_allocator *allocator, usize size);
/*
* Free all the allocated memory at once.
* This just sets the allocator cursor to its
* starting position.
* Free all the allocated memory at once. This just sets the allocator cursor
* to its starting position.
*/
void arena_bump(struct arena_allocator *allocator);