Changeset ffccdff0 in mainline for uspace/lib/c/generic/malloc.c


Ignore:
Timestamp:
2020-06-15T13:29:29Z (4 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f663f3e
Parents:
128359eb
Message:

Unify alignment handling

Use the C11 alignof() operator. Make sure the allocation alignment is
sufficient.

File:
1 edited

Legend:

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

    r128359eb rffccdff0  
    3535
    3636#include <malloc.h>
     37#include <stdalign.h>
    3738#include <stdbool.h>
    3839#include <stddef.h>
     
    198199
    199200#define malloc_assert(expr) safe_assert(expr)
     201
     202/*
     203 * Make sure the base alignment is sufficient.
     204 */
     205static_assert(BASE_ALIGN >= alignof(heap_area_t), "");
     206static_assert(BASE_ALIGN >= alignof(heap_block_head_t), "");
     207static_assert(BASE_ALIGN >= alignof(heap_block_foot_t), "");
     208static_assert(BASE_ALIGN >= alignof(max_align_t), "");
    200209
    201210/** Serializes access to the heap from multiple threads. */
Note: See TracChangeset for help on using the changeset viewer.