Esempio n. 1
0
static void fs_free(struct Oc_bpt_test_fs_ctx *fs_p)
{
    pl_mm_free(fs_p->fs_array);

    // extra sanitation 
    memset(fs_p, 0, sizeof(struct Oc_bpt_test_fs_ctx));

    pl_mm_free(fs_p);
}
Esempio n. 2
0
File: pl_mm.c Progetto: orodeh/bt
// destroy all objects in pool and release pool resources
void pl_mm_pool_delete( Pl_mm_op *pool_p,
                        void (*destroy_object_fun)( void *object_fun ) )
{
    int i;
    char *obj;

    assert(pool_p);
    assert(pool_p->all_objects_pp);
    for (i=0;i<pool_p->number;i++) {
        obj = (char*)pool_p->all_objects_pp[i];

        assert(obj);

        if (destroy_object_fun) {
            destroy_object_fun(obj);
        }

        pl_mm_free(obj);
        pool_p->all_objects_pp[i]=NULL;
    }

    pl_mm_free(pool_p->all_objects_pp);
    pl_mm_free(pool_p);
}
Esempio n. 3
0
// Release the labels hash-table
void oc_bpt_label_free(void)
{
    static Ss_slist cells;

    // extract the cells from the hash-table 
    ssslist_init(&cells);
    oc_utl_htbl_iter_mv_to_list(&htbl, oc_bpt_label_true_fun, NULL, &cells);

    // release all the cells
    while (!ssslist_empty(&cells)) {
        Oc_bpt_label_cell *cell_p;
        
        cell_p = (Oc_bpt_label_cell*) ssslist_remove_head(&cells);
        pl_mm_free(cell_p);
    }

    // release the hash-table
    oc_utl_htbl_free(&htbl);
    memset(&htbl, 0, sizeof(htbl));
}