static void enlarge_slot(struct cos_method_slot1 **slot) { U32 i, n = first_cell(slot); *slot = realloc(n ? *slot : 0, (n+1) * sizeof **slot); if (!*slot) cos_abort("method1_lookup: out of memory"); for (i = 0; i < (n+1); i++) { (*slot)[i].nxt = *slot+i+1; // Ok: see C99 6.5.6-8 (*slot)[i].fct = init; (*slot)[i].idg = 0; (*slot)[i].id1 = 0; } (*slot)[n].nxt = &sentinel; }
void cos_method_clearCache2(void) { struct cos_method_cache2 *cache = cos_method_cache2(); U32 i; if (cache->slot != &cache_empty) { for (i = 0; i <= cache->msk; i++) { struct cos_method_slot2 **slot = cache->slot+i; if (*slot != &sentinel) first_cell(slot), free(*slot); } free(cache->slot); cache->slot = &cache_empty; cache->msk = 0; cache->mis = 0; cache->mis2 = 0; } }
Boolean dl_list::insert_as_head(const dl_list_cell_handler& new_cell) { #ifdef A16_BROWSER dl_list_cell_handler* z = 0; #endif if ( v_dl_list_head.icode() != 0 ) { dl_list_cell_handler first_cell(v_dl_list_head, storage_ptr ); #ifdef A16_BROWSER z = (dl_list_cell_handler*)&new_cell; first_cell -> set_backward_ptr(z -> its_oid()); #else first_cell -> set_backward_ptr(new_cell.its_oid()); #endif } ((dl_list_cell_handler&)new_cell) -> set_forward_ptr(v_dl_list_head); #ifdef A16_BROWSER v_dl_list_head.become(z -> its_oid()); #else v_dl_list_head.become(new_cell.its_oid()); #endif if ( v_dl_list_tail.icode() == 0 ) v_dl_list_tail.become(v_dl_list_head); v_sz++; set_mode(HEALTH, true); insert_to_indices(new_cell); return true; }