From 682901cafdedd20839d21c368c401b40abc55390 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 8 Sep 2025 08:48:19 +0200 Subject: [PATCH 1/2] Remove unused defines FL_FREE, FL_USED --- freelist/freelist.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/freelist/freelist.h b/freelist/freelist.h index f0e8ed4..72a6d84 100644 --- a/freelist/freelist.h +++ b/freelist/freelist.h @@ -18,9 +18,6 @@ static inline size_t align_up(size_t n) { #define ALIGN(x) (align_up(x)) #endif // FREELIST_NOALIGN -#define FL_FREE ((uint8_t)0x00) -#define FL_USED ((uint8_t)0x01) - typedef struct FreeListBlock { struct FreeListBlock *next; } FreeListBlock; From de6aee3a3a9fc113d6bac4c8cd31b431fad02e8c Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 8 Sep 2025 08:48:34 +0200 Subject: [PATCH 2/2] Move FreeListBlock internal into source --- freelist/freelist.c | 4 ++++ freelist/freelist.h | 12 +++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/freelist/freelist.c b/freelist/freelist.c index 380010f..f9dc531 100644 --- a/freelist/freelist.c +++ b/freelist/freelist.c @@ -6,6 +6,10 @@ #include #include +struct FreeListBlock { + struct FreeListBlock *next; +}; + /* Initialize the FreeList */ int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize) { size_t size = ALIGN(itemsize); diff --git a/freelist/freelist.h b/freelist/freelist.h index 72a6d84..f0cf7c7 100644 --- a/freelist/freelist.h +++ b/freelist/freelist.h @@ -18,16 +18,14 @@ static inline size_t align_up(size_t n) { #define ALIGN(x) (align_up(x)) #endif // FREELIST_NOALIGN -typedef struct FreeListBlock { - struct FreeListBlock *next; -} FreeListBlock; +typedef struct FreeListBlock FreeListBlock; typedef struct { - uintptr_t start; - uintptr_t end; + uintptr_t start; + uintptr_t end; FreeListBlock *free; - size_t size; - size_t allocated; + size_t size; + size_t allocated; } FreeList; int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize);