BFC-Compiler
A C23 Brainfuck compiler
Loading...
Searching...
No Matches
bfc_memory.h
Go to the documentation of this file.
1
8#ifndef BFC_MEMORY_H
9#define BFC_MEMORY_H
10
11#include <stddef.h>
12
23[[gnu::malloc, gnu::alloc_size(1, 2)]]
24void* bfc_malloc_array(size_t count, size_t element_size);
25
36[[gnu::malloc, gnu::alloc_size(1, 2)]]
37void* bfc_calloc_array(size_t count, size_t element_size);
38
50[[gnu::alloc_size(2, 3)]]
51void* bfc_realloc_array(void* allocation, size_t count, size_t element_size);
52
56#define BFC_MALLOC_ARRAY(pointer, count) bfc_malloc_array((count), sizeof(*(pointer)))
57
58#define BFC_CALLOC_ARRAY(pointer, count) bfc_calloc_array((count), sizeof(*(pointer)))
59
60#define BFC_REALLOC_ARRAY(pointer, count) bfc_realloc_array((pointer), (count), sizeof(*(pointer)))
61
62#endif
void * bfc_calloc_array(size_t count, size_t element_size)
Allocates a zero-initialized array after checking count multiplication.
Definition bfc_memory.c:31
void * bfc_realloc_array(void *allocation, size_t count, size_t element_size)
Resizes a typed array after checking count multiplication.
Definition bfc_memory.c:46
void * bfc_malloc_array(size_t count, size_t element_size)
Allocates an uninitialized array after checking count multiplication.
Definition bfc_memory.c:16