PoeMac/C workers/heap.c
static void* map_in_pages(int page_count) {
    // Check everything
    assert(page_count > 0);

    // Call malloc to get the pages
    void* addr = malloc((size_t)(page_count*MEM_PAGE_SIZE));

    if (!addr)
        return NULL;
    else {
        // Clear the memory
        bzero(addr,page_count*MEM_PAGE_SIZE);

        // Return the address
        return addr;
    }
}
// Helper function to map a number of pages into memory
// Returns NULL on error, otherwise returns a pointer to the
// first page.
Helper function to map a number of pages into memory
Returns NULL on error, otherwise returns a pointer to the
first page.
Helper function to map a number of pages into memory Returns NULL on error otherwise returns a pointer to the first page .
static void* map_in_pages(int page_count) {
    assert(page_count > 0);
    void* addr = malloc((size_t)(page_count*MEM_PAGE_SIZE));
    if (!addr)
        return NULL;
    else {
        bzero(addr,page_count*MEM_PAGE_SIZE);
        return addr;
    }
}
static void * map_in_pages ( int page_count ) { assert ( page_count > 0 ) ; void * addr = malloc ( ( size_t ) ( page_count * MEM_PAGE_SIZE ) ) ; if ( ! addr ) return NULL ; else { bzero ( addr , page_count * MEM_PAGE_SIZE ) ; return addr ; } }
Helper function to map a number of pages into memory
Returns NULL on error, otherwise returns a pointer to the
first page.
Helper function to map a number of pages into memory Returns NULL on error otherwise returns a pointer to the first page .
// Check everything // Call malloc to get the pages // Clear the memory // Return the address