diff options
Diffstat (limited to 'firmware/include/buflib.h')
-rw-r--r-- | firmware/include/buflib.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h index aa6c232f72..0b26c04bcd 100644 --- a/firmware/include/buflib.h +++ b/firmware/include/buflib.h | |||
@@ -157,6 +157,21 @@ size_t buflib_available(struct buflib_context *ctx); | |||
157 | */ | 157 | */ |
158 | size_t buflib_allocatable(struct buflib_context *ctx); | 158 | size_t buflib_allocatable(struct buflib_context *ctx); |
159 | 159 | ||
160 | /** | ||
161 | * Relocates the fields in *ctx to the new buffer position pointed to by buf. | ||
162 | * This does _not_ move any data but updates the pointers. The data has | ||
163 | * to be moved afterwards manually and only if this function returned true. | ||
164 | * | ||
165 | * This is intended to be called from within a move_callback(), for | ||
166 | * buflib-on-buflib scenarios (i.e. a new buflib instance backed by a buffer | ||
167 | * that was allocated by another buflib instance). Be aware that if the parent | ||
168 | * move_callback() moves the underlying buffer _no_ move_callback() of the | ||
169 | * underlying buffer are called. | ||
170 | * | ||
171 | * Returns true of the relocation was successful. If it returns false no | ||
172 | * change to *ctx was made. | ||
173 | */ | ||
174 | bool buflib_context_relocate(struct buflib_context *ctx, void *buf); | ||
160 | 175 | ||
161 | /** | 176 | /** |
162 | * Allocates memory from buflib's memory pool | 177 | * Allocates memory from buflib's memory pool |