Changes in uspace/lib/c/generic/malloc.c [ffccdff0:25f6bddb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/malloc.c
rffccdff0 r25f6bddb 35 35 36 36 #include <malloc.h> 37 #include <stdalign.h>38 37 #include <stdbool.h> 39 38 #include <stddef.h> … … 82 81 (sizeof(heap_block_head_t) + sizeof(heap_block_foot_t)) 83 82 84 /** Calculate real size of a heap block.85 *86 * Add header and footer size.87 *88 */89 #define GROSS_SIZE(size) ((size) + STRUCT_OVERHEAD)90 91 /** Calculate net size of a heap block.92 *93 * Subtract header and footer size.94 *95 */96 #define NET_SIZE(size) ((size) - STRUCT_OVERHEAD)97 98 83 /** Overhead of each area. */ 99 84 #define AREA_OVERHEAD(size) \ 100 (ALIGN_UP(GROSS_SIZE(size) + sizeof(heap_area_t), BASE_ALIGN)) 85 (ALIGN_UP(size + sizeof(heap_area_t), BASE_ALIGN)) 86 87 /** Calculate real size of a heap block. 88 * 89 * Add header and footer size. 90 * 91 */ 92 #define GROSS_SIZE(size) ((size) + STRUCT_OVERHEAD) 93 94 /** Calculate net size of a heap block. 95 * 96 * Subtract header and footer size. 97 * 98 */ 99 #define NET_SIZE(size) ((size) - STRUCT_OVERHEAD) 101 100 102 101 /** Get first block in heap area. … … 199 198 200 199 #define malloc_assert(expr) safe_assert(expr) 201 202 /*203 * Make sure the base alignment is sufficient.204 */205 static_assert(BASE_ALIGN >= alignof(heap_area_t), "");206 static_assert(BASE_ALIGN >= alignof(heap_block_head_t), "");207 static_assert(BASE_ALIGN >= alignof(heap_block_foot_t), "");208 static_assert(BASE_ALIGN >= alignof(max_align_t), "");209 200 210 201 /** Serializes access to the heap from multiple threads. */
Note:
See TracChangeset
for help on using the changeset viewer.