Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c828803 in mainline


Ignore:
Timestamp:
2012-07-24T10:04:01Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
f66c203d
Parents:
da287d1
Message:

add comment describing the motivation for the alignment

File:
1 edited

Legend:

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

    rda287d1 rc828803  
    720720                return NULL;
    721721       
     722        /*
     723         * The size of the allocated block needs to be naturally
     724         * aligned, because the footer structure also needs to reside
     725         * on a naturally aligned address in order to avoid unaligned
     726         * memory accesses.
     727         */
    722728        size_t gross_size = GROSS_SIZE(ALIGN_UP(size, BASE_ALIGN));
    723729       
     
    760766void *calloc(const size_t nmemb, const size_t size)
    761767{
     768        // FIXME: Check for overflow
     769       
    762770        void *block = malloc(nmemb * size);
    763771        if (block == NULL)
     
    899907        if (addr == NULL)
    900908                return;
    901 
     909       
    902910        futex_down(&malloc_futex);
    903911       
Note: See TracChangeset for help on using the changeset viewer.