Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/malloc.c

    rffccdff0 r25f6bddb  
    3535
    3636#include <malloc.h>
    37 #include <stdalign.h>
    3837#include <stdbool.h>
    3938#include <stddef.h>
     
    8281        (sizeof(heap_block_head_t) + sizeof(heap_block_foot_t))
    8382
    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 
    9883/** Overhead of each area. */
    9984#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)
    101100
    102101/** Get first block in heap area.
     
    199198
    200199#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), "");
    209200
    210201/** Serializes access to the heap from multiple threads. */
Note: See TracChangeset for help on using the changeset viewer.