Exemplo n.º 1
0
static alloc_status _mem_add_to_gap_ix(pool_mgr_pt pool_mgr,
                                       size_t size,
                                       node_pt node) {
    int i = 0;
    // expand the gap index, if necessary (call the function)
    _mem_resize_gap_ix(pool_mgr);
    // add the entry at the end
    pool_mgr->gap_ix[i].size = size;
    pool_mgr->gap_ix[i].node = node;
    // update metadata (num_gaps)
    (pool_mgr->pool.num_gaps)++;
    // sort the gap index (call the function)
    // check success

    return ALLOC_FAIL;
}
Exemplo n.º 2
0
static alloc_status _mem_add_to_gap_ix(pool_mgr_pt pool_mgr,
                                       size_t size,
                                       node_pt node) {
    // expand the gap index
    _mem_resize_gap_ix(pool_mgr);

    // add the entry at the last slot (total number of gaps)
    pool_mgr->gap_ix[pool_mgr->pool.num_gaps].node = node;
    pool_mgr->gap_ix[pool_mgr->pool.num_gaps].size = size;

    // increment number of gaps
    pool_mgr->pool.num_gaps++;

    // check if the gap sort is successful, return ok
    if(_mem_sort_gap_ix(pool_mgr) == ALLOC_OK){
        return ALLOC_OK;
    };

    return ALLOC_FAIL;
}
Exemplo n.º 3
0
static alloc_status _mem_add_to_gap_ix(pool_mgr_pt pool_mgr,
                                       size_t size,
                                       node_pt node) {
    // check success
    // expand the gap index, if necessary (call the function)
    _mem_resize_gap_ix(pool_mgr);

    // add the entry at the end
    pool_mgr->gap_ix[pool_mgr->pool.num_gaps].size = size;
    pool_mgr->gap_ix[pool_mgr->pool.num_gaps].node = node;

    // update metadata (num_gaps)
    pool_mgr->pool.num_gaps++;

    // sort the gap index (call the function)
    if (_mem_sort_gap_ix(pool_mgr) != ALLOC_OK)
        return ALLOC_FAIL;

    return ALLOC_OK;
}