88#include " multi_heap.h"
99
1010#include " ../multi_heap_config.h"
11- #include " ../tlsf/tlsf.h"
12- #include " ../tlsf/tlsf_common.h"
11+ #include " ../tlsf/include/tlsf.h"
1312#include " ../tlsf/tlsf_block_functions.h"
13+ #include " ../tlsf/tlsf_control_functions.h"
1414
1515#include < string.h>
1616#include < assert.h>
1919 * malloc and free and allocate memory from the host heap. Since the test
2020 * `TEST_CASE("multi_heap many random allocations", "[multi_heap]")`
2121 * calls multi_heap_allocation_impl() with sizes that can go up to 8MB,
22- * an allocatation on the heap will be prefered rather than the stack which
22+ * an allocatation on the heap will be preferred rather than the stack which
2323 * might not have the necessary memory.
2424 */
2525static void *__malloc__ (size_t bytes)
@@ -62,7 +62,7 @@ TEST_CASE("multi_heap simple allocations", "[multi_heap]")
6262 REQUIRE ( (intptr_t )buf < (intptr_t )(small_heap + sizeof (small_heap)));
6363
6464 REQUIRE ( multi_heap_get_allocated_size (heap, buf) >= test_alloc_size );
65- REQUIRE ( multi_heap_get_allocated_size (heap, buf) < test_alloc_size + 16 );
65+ printf ( " test alloc size %d \n " , test_alloc_size);
6666
6767 memset (buf, 0xEE , test_alloc_size);
6868
@@ -482,7 +482,7 @@ TEST_CASE("multi_heap aligned allocations", "[multi_heap]")
482482{
483483 uint8_t test_heap[4 * 1024 ];
484484 multi_heap_handle_t heap = multi_heap_register (test_heap, sizeof (test_heap));
485- uint32_t aligments = 0 ; // starts from alignment by 4-byte boundary
485+ uint32_t alignments = 0 ; // starts from alignment by 4-byte boundary
486486 size_t old_size = multi_heap_free_size (heap);
487487 size_t leakage = 1024 ;
488488 printf (" [ALIGNED_ALLOC] heap_size before: %d \n " , old_size);
@@ -491,26 +491,26 @@ TEST_CASE("multi_heap aligned allocations", "[multi_heap]")
491491 multi_heap_dump (heap);
492492 printf (" *********************\n " );
493493
494- for (;aligments <= 256 ; aligments ++) {
494+ for (;alignments <= 256 ; alignments ++) {
495495
496496 // Use some stupid size value to test correct alignment even in strange
497497 // memory layout objects:
498- uint8_t *buf = (uint8_t *)multi_heap_aligned_alloc (heap, (aligments + 137 ), aligments );
499- if (((aligments & (aligments - 1 )) != 0 ) || (!aligments )) {
498+ uint8_t *buf = (uint8_t *)multi_heap_aligned_alloc (heap, (alignments + 137 ), alignments );
499+ if (((alignments & (alignments - 1 )) != 0 ) || (!alignments )) {
500500 REQUIRE ( buf == NULL );
501501 } else {
502502 REQUIRE ( buf != NULL );
503503 REQUIRE ((intptr_t )buf >= (intptr_t )test_heap);
504504 REQUIRE ((intptr_t )buf < (intptr_t )(test_heap + sizeof (test_heap)));
505505
506- printf (" [ALIGNED_ALLOC] alignment required: %u \n " , aligments );
506+ printf (" [ALIGNED_ALLOC] alignment required: %u \n " , alignments );
507507 printf (" [ALIGNED_ALLOC] address of allocated memory: %p \n\n " , (void *)buf);
508508 // Address of obtained block must be aligned with selected value
509- REQUIRE (((intptr_t )buf & (aligments - 1 )) == 0 );
509+ REQUIRE (((intptr_t )buf & (alignments - 1 )) == 0 );
510510
511511 // Write some data, if it corrupts memory probably the heap
512512 // canary verification will fail:
513- memset (buf, 0xA5 , (aligments + 137 ));
513+ memset (buf, 0xA5 , (alignments + 137 ));
514514
515515 multi_heap_free (heap, buf);
516516 }
@@ -519,7 +519,7 @@ TEST_CASE("multi_heap aligned allocations", "[multi_heap]")
519519 /* Check that TLSF doesn't allocate a memory space smaller than required.
520520 * In any case, TLSF will write data in the previous block than the one
521521 * allocated. Thus, we should try to get/allocate this previous block. If
522- * the poisoned filled pattern has beeen overwritten by TLSF, then this
522+ * the poisoned filled pattern has been overwritten by TLSF, then this
523523 * previous block will trigger an exception.
524524 * More info on this bug in !16296. */
525525 const size_t size = 50 ; /* TLSF will round the size up */
0 commit comments