From 35674243f07216ce94c2680fde13ee9df48d766c Mon Sep 17 00:00:00 2001 From: Matthew Sotoudeh Date: Thu, 16 May 2024 10:39:47 -0700 Subject: support for moving the allocation pool --- buddy.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'buddy.h') diff --git a/buddy.h b/buddy.h index 0b4de09..ad4f4aa 100644 --- a/buddy.h +++ b/buddy.h @@ -24,3 +24,8 @@ void debug_buddy(struct buddy *state); void *reallocate(void *old, size_t old_size, size_t new_size, struct buddy *state); int reserve(void *start, size_t size, struct buddy *state); + +// grow can also be used to move the buddy. grow can never fail. +void grow_buddy(uint8_t *new_base, size_t new_size, struct buddy *state); +// 0 -> failure. always in-place. to do out-of-place, first shrink then grow. +int shrink_buddy(size_t new_size, struct buddy *state); -- cgit v1.2.3