BUG: Walking logic in check() is broken. Moving aligning into source, removing macros
This commit is contained in:
parent
d608a81674
commit
04c8311528
6 changed files with 115 additions and 46 deletions
|
|
@ -5,18 +5,6 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Align to nearest multiple of align */
|
||||
static inline size_t align_up_to(size_t n, size_t align) {
|
||||
return (n + align - 1) & ~(align - 1);
|
||||
}
|
||||
|
||||
/* Fiddle these around according to your need. Delete or check makefile */
|
||||
#ifdef FREELIST_ALIGN
|
||||
#define ALIGN(x) (align_up_to(x, sizeof(void *)))
|
||||
#else
|
||||
#define ALIGN(x) (x)
|
||||
#endif
|
||||
|
||||
typedef struct FreeListBlock FreeListBlock;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -27,7 +15,7 @@ typedef struct {
|
|||
size_t allocated;
|
||||
} FreeList;
|
||||
|
||||
int fl_init(FreeList *fl, uintptr_t start, uintptr_t end, size_t itemsize);
|
||||
int fl_init(FreeList *fl, uintptr_t start, size_t size_bytes, size_t itemsize);
|
||||
int fl_free(FreeList *fl, void *ptr);
|
||||
int fl_is_managed(FreeList *fl, void *ptr);
|
||||
void *fl_alloc(FreeList *fl);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue