infix-calculator/lib/include/memory_pool.h

22 lines
401 B
C

/*
* Copyright (c) Camden Dixie O'Brien
* SPDX-License-Identifier: AGPL-3.0-only
*/
#ifndef MEMORY_POOL_H
#define MEMORY_POOL_H
#include "expression.h"
#define MEMORY_POOL_SIZE 128U
typedef struct {
expression_t buffer[MEMORY_POOL_SIZE];
expression_t *free_pointer;
} memory_pool_t;
void init_memory_pool(memory_pool_t *pool);
expression_t *allocate_expression(memory_pool_t *pool);
#endif