// callback to replace variable at index 'idx' with definition 'def' and updated formula 'fml' virtual void elim_var(unsigned idx, expr* fml, expr* def) { m_fml = fml; m_pos.reset(); m_neg.reset(); get_nnf(m_fml, get_is_relevant(), get_mk_atom(), m_pos, m_neg); m_vars.erase(idx); dealloc(m_contains_app[idx]); m_contains_app.erase(m_contains_app.c_ptr() + idx); }
status_t SimpleBestFitAllocator::deallocate(size_t offset) { Mutex::Autolock _l(mLock); chunk_t const * const freed = dealloc(offset); if (freed) { return NO_ERROR; } return NAME_NOT_FOUND; }
int fdclose(struct open_file *f) { struct fd_softc *sc = f->f_devdata; IOCS_B_DRVCHK((0x90 + sc->unit) << 8, 3); dealloc(sc, sizeof(struct fd_softc)); return 0; }
void model_evaluator_util::reset(model* model) { if (m_mev) { dealloc(m_mev); m_mev = NULL; } m_model = model; if (!m_model) { return; } m_mev = alloc(model_evaluator, *m_model); }
~join_planner() { cost_map::iterator it = m_costs.begin(); cost_map::iterator end = m_costs.end(); for (; it != end; ++it) { dealloc(it->m_value); } m_costs.reset(); }
/*=========================================================================== * FUNCTION : deallocate * * DESCRIPTION: deallocate buffers * * PARAMETERS : none * * RETURN : none *==========================================================================*/ void QCamera3HeapMemory::deallocate() { for (int i = 0; i < mBufferCount; i++) { munmap(mPtr[i], mMemInfo[i].size); mPtr[i] = NULL; } dealloc(); mBufferCount = 0; }
model::~model() { sort2universe::iterator it3 = m_usort2universe.begin(); sort2universe::iterator end3 = m_usort2universe.end(); for (; it3 != end3; ++it3) { m_manager.dec_ref(it3->m_key); m_manager.dec_array_ref(it3->m_value->size(), it3->m_value->c_ptr()); dealloc(it3->m_value); } }
__compactcall int ext2fs_close(struct open_file *f) { struct file *fp = (struct file *)f->f_fsdata; f->f_fsdata = NULL; if (fp == NULL) return 0; if (fp->f_fs->e2fs_gd) dealloc(fp->f_fs->e2fs_gd, sizeof(struct ext2_gd) * fp->f_fs->e2fs_ncg); if (fp->f_buf) dealloc(fp->f_buf, fp->f_fs->e2fs_bsize); dealloc(fp->f_fs, sizeof(*fp->f_fs)); dealloc(fp, sizeof(struct file)); return 0; }
void func_decl_dependencies::erase(func_decl * f) { func_decl_set * s = 0; if (m_deps.find(f, s)) { m_manager.dec_ref(f); dec_ref(m_manager, *s); m_deps.erase(f); dealloc(s); } }
void grobner::del_monomial(monomial * m) { ptr_vector<expr>::iterator it2 = m->m_vars.begin(); ptr_vector<expr>::iterator end2 = m->m_vars.end(); for (; it2 != end2; ++it2) { expr * v = *it2; m_manager.dec_ref(v); } dealloc(m); }
virtual void reset() { if (m_context != 0) { #pragma omp critical (solver) { dealloc(m_context); m_context = 0; } } }
/*=========================================================================== * FUNCTION : deallocate * * DESCRIPTION: deallocate buffers * * PARAMETERS : none * * RETURN : none *==========================================================================*/ void QCameraStreamMemory::deallocate() { for (int i = 0; i < mBufferCount; i ++) { mCameraMemory[i]->release(mCameraMemory[i]); mCameraMemory[i] = NULL; } dealloc(); mBufferCount = 0; }
void free_opts(struct opts* opt) { while(opt) { void* tmp=opt->next; if(opt->value) { dealloc((void*)opt->value); opt->value=NULL; } if(opt->name) { dealloc((void*)opt->name); opt->name=NULL; } opt->next=NULL; tmp=opt; opt=opt->next; dealloc(tmp); } }
void dvma_free(char *dvma, int len) { char *mem; mem = dvma_mapout(dvma, len); if (mem != NULL) dealloc(mem, len); }
int main(int argc, char *argv[]) { if (argc != 5){ printf("usage: ex29 english_words foreign_words replace_text out_file\n"); exit(1); } char *foreign[DICT_SIZE], *english[DICT_SIZE], *words[MAX_IN]; int i, words_len; FILE *fp = fopen(argv[3], "r"); char tmp[MAX_IN]; fgets(tmp, MAX_IN, fp); fclose(fp); words_len = str_spc_split(tmp, words); read_file(argv[1], english, DICT_SIZE); read_file(argv[2], foreign, DICT_SIZE); fp = fopen(argv[4], "w"); int wloc; for (i = 0; i < words_len; ++i){ if ((wloc = contains(english, words[i], DICT_SIZE))){ fputs(foreign[wloc - 1], fp); fputc(' ', fp); } else { fputs(words[i], fp); fputc(' ', fp); } } fclose(fp); dealloc(english, DICT_SIZE); dealloc(foreign, DICT_SIZE); dealloc(words, words_len); return 0; }
void DieHolder::get_frame_base_offsets(OffsetAreas &offset_areas) { Dwarf_Attribute attrib = get_attr(DW_AT_frame_base); Dwarf_Locdesc **llbuf = NULL; Dwarf_Locdesc *locdesc = NULL; Dwarf_Signed count = 0; Dwarf_Error err = NULL; DwarfDealloc dealloc(m_dbg); CHECK_DWERR2(attrib == NULL, NULL, "retrieving an operand implies finding the attribute..."); CHECK_DWERR(dwarf_loclist_n(attrib, &llbuf, &count, &err), err, "cannot get location descriptions"); dealloc.add(llbuf, DW_DLA_LIST); for(Dwarf_Signed idx = 0; idx < count; ++idx) { ea_t low_pc = 0; ea_t high_pc = 0; locdesc = llbuf[idx]; // handle deallocation too dealloc.add(llbuf[idx], DW_DLA_LOCDESC); dealloc.add(llbuf[idx]->ld_s, DW_DLA_LOC_BLOCK); // only 1 location in a location description is supported if(locdesc->ld_cents == 1) { Dwarf_Loc *loc = &locdesc->ld_s[0]; Dwarf_Small const atom = loc->lr_atom; // from a location block? if(!locdesc->ld_from_loclist) { low_pc = BADADDR; high_pc = BADADDR; } // this loc desc is from a location list else { low_pc = static_cast<ea_t>(locdesc->ld_lopc); high_pc = static_cast<ea_t>(locdesc->ld_hipc); } // is it the right atom to get the offset from? if(atom == DW_OP_breg4 || atom == DW_OP_breg5) { offset_areas.push_back(OffsetArea(low_pc, high_pc, // operand is unsigned, but should be signed... static_cast<sval_t>(loc->lr_number), (atom == DW_OP_breg5))); } } } }
context::~context() { m_last_obj = 0; if (!m_user_ref_count) { for (unsigned i = 0; i < m_replay_stack.size(); ++i) { dealloc(m_replay_stack[i]); } m_ast_trail.reset(); } reset_parser(); }
void params::del_value(entry & e) { switch (e.second.m_kind) { case CPK_NUMERAL: if (e.second.m_kind == CPK_NUMERAL) dealloc(e.second.m_rat_value); break; default: return; } }
bool func_decl_dependencies::insert(func_decl * f, func_decl_set * s) { if (m_deps.contains(f)) { dealloc(s); return false; } m_deps.insert(f, s); top_sort cycle_detector(m_manager, m_deps); if (cycle_detector(f)) { m_deps.erase(f); dealloc(s); return false; } m_manager.inc_ref(f); inc_ref(m_manager, *s); return true; }
void rational::finalize() { finalize_inf_rational(); finalize_inf_int_rational(); m_powers_of_two.finalize(); m_zero.~rational(); m_one.~rational(); m_minus_one.~rational(); dealloc(g_mpq_manager); g_mpq_manager = nullptr; }
void reset() { #pragma omp critical (gparams) { m_params.reset(); for (auto & kv : m_module_params) { dealloc(kv.m_value); } m_module_params.reset(); } }
void context::reset_parser() { if (m_smtlib_parser) { dealloc(m_smtlib_parser); m_smtlib_parser = 0; m_smtlib_parser_has_decls = false; m_smtlib_parser_decls.reset(); m_smtlib_parser_sorts.reset(); } SASSERT(!m_smtlib_parser_has_decls); }
void attrsfree(struct Cons* a) { struct Cons* next; for(;a;) { struct opts* p=(struct opts*)firstp((LVal)a); s((char*)p->name),s((char*)p->value); next=(struct Cons*)a->next; dealloc(a); a=next; } }
int cd9660_close(struct open_file *f) { struct file *fp = (struct file *)f->f_fsdata; f->f_fsdata = 0; dealloc(fp, sizeof *fp); return 0; }
context::~context() { m_last_obj = nullptr; u_map<api::object*>::iterator it = m_allocated_objects.begin(); while (it != m_allocated_objects.end()) { api::object* val = it->m_value; DEBUG_CODE(warning_msg("Uncollected memory: %d: %s", it->m_key, typeid(*val).name());); m_allocated_objects.remove(it->m_key); dealloc(val); it = m_allocated_objects.begin(); }
context::~context() { reset_parser(); m_last_obj = 0; u_map<api::object*>::iterator it = m_allocated_objects.begin(); while (it != m_allocated_objects.end()) { DEBUG_CODE(warning_msg("Uncollected memory: %d: %s", it->m_key, typeid(*it->m_value).name());); m_allocated_objects.remove(it->m_key); dealloc(it->m_value); it = m_allocated_objects.begin(); }
table_base* lazy_table_join::force() { SASSERT(!m_table); table_base* t1 = m_t1->eval(); table_base* t2 = m_t2->eval(); verbose_action _t("join"); table_join_fn* join = rm().mk_join_fn(*t1, *t2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr()); m_table = (*join)(*t1, *t2); dealloc(join); return m_table.get(); }
__compactcall void lsfree(lsentry_t *names) { if (!names) return; do { lsentry_t *n = names; names = n->e_next; dealloc(n, 0); } while (names); }
ssize_t SimpleBestFitAllocator::deallocate(size_t offset) { Locker::Autolock _l(mLock); if (mHeapSize == 0) return -EINVAL; chunk_t const * const freed = dealloc(offset); if (freed) { return 0; } return -ENOENT; }
static void remove_connection(web_context * ctx, const char * name){ size_t * size = &ctx->connection_cnt; connection * conns = ctx->active_connections; connection * con = get_connection_by_name(ctx, name); dealloc(con->name); ASSERT(con != NULL); size_t next_offset = ((con + 1) - conns); memmove(con, con + 1, (*size - next_offset) * sizeof(connection)); *size -= 1; }