Files
2026-08-10 01:21:15 +08:00

30 lines
752 B
C

#ifndef INCLUDED_C_BUDDY_H
#define INCLUDED_C_BUDDY_H
#ifndef INCLUDED_C_BASE_H
#include <c_Base.h>
#endif /*INCLUDED_C_BASE_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
int size;
c_bool_t is_free;
}c_BuddyBlock_t;
typedef struct {
c_BuddyBlock_t* head;
c_BuddyBlock_t* tail;
int alignment;
}c_Buddy_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
void c_Buddy_Init(c_Buddy_t *b, void *data, int size, int alignment);
void *c_Buddy_Alloc(c_Buddy_t *b, int size);
void c_Buddy_Free(c_Buddy_t *b, void *data);
#endif /*INCLUDED_C_BUDDY_H*/