Beispiel #1
0
Datei: coat.c Projekt: seL4/refos
void coat_release(coat_t *t) {
    assert(t);
    size_t count = cvector_count(&t->table);
    for (int i = 0; i < count; i++) {
        cvector_item_t obj = cvector_get(&t->table, i);
        if (!obj) continue;
        if (t->oat_delete) {
            t->oat_delete(t, obj);
        }
    }
    cvector_free(&t->table);
    cpool_release(&t->pool);
}
Beispiel #2
0
static int
test_cpool(void)
{
    test_start("cpool");
    cpool_t p;
    cpool_init(&p, 1, 10240);
    for (int i = 1; i < 10240; i+=2) {
        int v = cpool_alloc(&p);
        test_assert(v >= 1 && v <= 10240);
        test_assert(cpool_check(&p, v) == false);
    }
    cpool_free(&p, 1);
    int v = cpool_alloc(&p);
    test_assert(v == 1);
    cpool_release(&p);
    return test_success();
}