diff --git a/firmware/buflib.c b/firmware/buflib.c index 27a6965ee0..8d5fe1eef3 100644 --- a/firmware/buflib.c +++ b/firmware/buflib.c @@ -55,6 +55,8 @@ * to find the start of the character array (and therefore the start of the * entire block) when only the handle or payload start is known. * + * UPDATE BUFLIB_ALLOC_OVERHEAD (buflib.h) WHEN THIS COOKIE CHANGES! + * * Example: * |<- alloc block #1 ->|<- unalloc block ->|<- alloc block #2 ->|<-handle table->| * |L|H|C|cccc|L2|crc|XXXXXX|-L|YYYYYYYYYYYYYYYY|L|H|C|cc|L2|crc|XXXXXXXXXXXXX|AAA| diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h index e912429b1f..1bae3e7a3f 100644 --- a/firmware/include/buflib.h +++ b/firmware/include/buflib.h @@ -53,6 +53,17 @@ struct buflib_context bool compact; }; +/** + * This declares the minimal overhead that is required per alloc. These + * are bytes that are allocated from the context's pool in addition + * to the actually requested number of bytes. + * + * The total number of bytes consumed by an allocation is + * BUFLIB_ALLOC_OVERHEAD + requested bytes + strlen(