diff options
| author | Mistivia <i@mistivia.com> | 2025-03-25 12:05:20 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-03-25 12:05:20 +0800 |
| commit | dc87ff4b0c9f311be7fad652594e3766a4ddb0c6 (patch) | |
| tree | 8e7d1c9045b8abec12b4682a2bb4d8a5b217139e /src/utils.c | |
| parent | 4188f791787be19f32226b8ac0f213f61cdd4666 (diff) | |
refactor name
Diffstat (limited to 'src/utils.c')
| -rw-r--r-- | src/utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.c b/src/utils.c index b9e7eaf..fdd8452 100644 --- a/src/utils.c +++ b/src/utils.c @@ -9,8 +9,8 @@ struct allocator { size_t len; }; -allocator_t new_allocator() { - allocator_t alct = malloc(sizeof(struct allocator)); +struct allocator * new_allocator() { + struct allocator * alct = malloc(sizeof(struct allocator)); alct->bufs = malloc(sizeof(void*) * 16); alct->cap = 16; alct->len = 0; @@ -18,7 +18,7 @@ allocator_t new_allocator() { return alct; } -void delete_allocator(allocator_t alct) { +void delete_allocator(struct allocator * alct) { for (size_t i = 0; i < alct->len; i++) { free(alct->bufs[i]); } @@ -26,7 +26,7 @@ void delete_allocator(allocator_t alct) { free(alct); } -void * allocate(allocator_t alct, size_t size) { +void * allocate(struct allocator * alct, size_t size) { assert(size > 0); if (alct->len >= alct->cap) { alct->cap = alct->cap * 2; // Doubling the capacity |
