Esempio n. 1
0
bool_t
Snapshot_delete_entry(Snapshot *self, const CharBuf *entry)
{
    Obj *val = Hash_Delete(self->entries, entry);
    if (val) { 
        Obj_Dec_RefCount(val);
        return true;
    }
    else {
        return false;
    }
}
Esempio n. 2
0
static void
test_refcounts(TestBatch *batch) {
    Obj *obj = S_new_testobj();

    TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 1,
                "Correct starting refcount");

    Obj_Inc_RefCount(obj);
    TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 2, "Inc_RefCount");

    Obj_Dec_RefCount(obj);
    TEST_INT_EQ(batch, Obj_Get_RefCount(obj), 1, "Dec_RefCount");

    DECREF(obj);
}