Files
cAI/cKit/Memory/c_FixedPool.h
T
2026-08-10 01:21:15 +08:00

26 lines
820 B
C

#ifndef INCLUDED_C_FIXEDPOOL_H
#define INCLUDED_C_FIXEDPOOL_H
#ifndef INCLUDED_C_BASE_H
#include <c_Base.h>
#endif /*INCLUDED_C_BASE_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
int objSize;
c_size_t instanceCount;
struct c_FixedPoolLink_t{ struct c_FixedPoolLink_t* next;} * freelist;
}c_FixedPool_t;
c_err_t c_FixedPool_Init(c_FixedPool_t* self, int objSize, void* block, int block_size);
void c_FixedPool_Destroy(c_FixedPool_t* self);
c_err_t c_FixedPool_AddBlock(c_FixedPool_t* self, void* block, int block_size);
void* c_FixedPool_Alloc(c_FixedPool_t* self);
void c_FixedPool_Free(c_FixedPool_t* self, void* ptr);
void c_FixedPool_DryUp(c_FixedPool_t* self);
#endif /*INCLUDED_C_FIXEDPOOL_H*/