void ColaTopologyAddon::handleResizes(const cola::Resizes& resizeList, unsigned n, std::valarray<double>& X, std::valarray<double>& Y, cola::CompoundConstraints& ccs, vpsc::Rectangles& boundingBoxes, cola::RootCluster* clusterHierarchy) { FILE_LOG(cola::logDEBUG) << "ColaTopologyAddon::handleResizes()..."; if(topologyNodes.empty()) { COLA_ASSERT(topologyRoutes.empty()); return; } // all shapes to be resized are wrapped in a ResizeInfo and // placed in a lookup table, resizes, indexed by id ResizeMap resizes; for(cola::Resizes::const_iterator r=resizeList.begin();r!=resizeList.end();++r) { topology::ResizeInfo ri(topologyNodes[r->getID()],r->getTarget()); resizes.insert(std::make_pair(r->getID(),ri)); } vpsc::Variables xvs, yvs; vpsc::Constraints xcs, ycs; cola::setupVarsAndConstraints(n, ccs, vpsc::HORIZONTAL, boundingBoxes, clusterHierarchy, xvs, xcs, X); cola::setupVarsAndConstraints(n, ccs, vpsc::VERTICAL, boundingBoxes, clusterHierarchy, yvs, ycs, Y); topology::applyResizes(topologyNodes, topologyRoutes, clusterHierarchy, resizes, xvs, xcs, yvs, ycs); for_each(xvs.begin(), xvs.end(), delete_object()); for_each(yvs.begin(), yvs.end(), delete_object()); for_each(xcs.begin(), xcs.end(), delete_object()); for_each(ycs.begin(), ycs.end(), delete_object()); FILE_LOG(cola::logDEBUG) << "ColaTopologyAddon::handleResizes()... done."; }
void comm_server::delete_unused_objects(std::vector<size_t> object_ids, bool active_list) { std::sort(object_ids.begin(), object_ids.end()); if (active_list) { // Get vector of IDs that are not used anymore on the client std::vector<std::pair<size_t, std::shared_ptr<void>> > v; { boost::lock_guard<boost::mutex> guard(registered_object_lock); // delete everything not in the active list std::set_difference(registered_objects.cbegin(), registered_objects.cend(), object_ids.cbegin(), object_ids.cend(), std::inserter(v, v.begin()), object_map_key_cmp()); } // Actually delete objects for(auto i : v) { if(i.first != 0) { delete_object(i.first); } } } else { // delete everything in the active list for(auto i : object_ids) { boost::unique_lock<boost::mutex> guard(registered_object_lock); if (registered_objects.count(i)) { // delete object has its own lock guard.unlock(); delete_object(i); } } } }
void TEST_COPY_OBJECT_WITH_DIFF_BUCKET() { int error; buffer* resp = NULL; const char* src_obj_key = "unit_test_dir/src_object1"; resp = delete_object(host, src_bucket, src_obj_key, ak, sk, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(204 == resp->status_code || 404 == resp->status_code); buffer_free(resp); // upload first const char* filename = "./lib/libcunit.a"; resp = upload_file_object(host, src_bucket, src_obj_key, filename, ak, sk, NULL, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(200 == resp->status_code); if (resp->status_code != 200) { printf("status code = %ld\n", resp->status_code); printf("status msg = %s\n", resp->status_msg); printf("error msg = %s\n", resp->body); } buffer_free(resp); // copy obj const char* dst_obj_key = src_obj_key; resp = delete_object(host, dst_bucket, dst_obj_key, ak, sk, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(204 == resp->status_code || 404 == resp->status_code); buffer_free(resp); resp = copy_object(host, src_bucket, src_obj_key, dst_bucket, dst_obj_key, ak, sk, NULL, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(200 == resp->status_code); if (200 != resp->status_code) { printf("status code = %ld\n", resp->status_code); printf("status msg = %s\n", resp->status_msg); printf("error msg = %s\n", resp->body); } buffer_free(resp); // delete src and dst obj resp = delete_object(host, src_bucket, src_obj_key, ak, sk, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(204 == resp->status_code); buffer_free(resp); resp = delete_object(host, dst_bucket, dst_obj_key, ak, sk, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(204 == resp->status_code); buffer_free(resp); }
void BakerGC::free_objects() { Object* obj = current->first_object(); while(obj < current->current) { delete_object(obj); obj = next_object(obj); } assert(next->current < next->last); obj = next->first_object(); while(obj < next->current) { delete_object(obj); obj = next_object(obj); } }
/** * Creates magical stairs after finishing a quest monster. */ static void build_quest_stairs(int y, int x) { int ny, nx; /* Stagger around */ while (!cave_valid_bold(y, x)) { int d = 1; /* Pick a location */ scatter(&ny, &nx, y, x, d, FALSE); /* Stagger */ y = ny; x = nx; } /* Destroy any objects */ delete_object(y, x); /* Explain the staircase */ msg("A magical staircase appears..."); /* Create stairs down */ /* XXX: fake depth = 0 to always produce downstairs */ cave_add_stairs(cave, y, x, 0); /* Update the visuals */ p_ptr->update |= (PU_UPDATE_VIEW | PU_MONSTERS); /* Fully update the flow */ p_ptr->update |= (PU_FORGET_FLOW | PU_UPDATE_FLOW); }
bool cps_db::delete_object(cps_db::connection &conn,cps_api_object_t obj) { std::vector<char> key; if (cps_db::dbkey_from_instance_key(key,obj)) { return delete_object(conn,key); } return false; }
void TEST_COPY_OBJECT_WITH_SRC_OBJECT_NOT_EXIST() { int error; buffer* resp = NULL; const char* src_obj_key = "src_object_not_exist"; // delete src object resp = delete_object(host, src_bucket, src_obj_key, ak, sk, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(204 == resp->status_code || 404 == resp->status_code); buffer_free(resp); // copy obj const char* dst_obj_key = src_obj_key; resp = copy_object(host, src_bucket, src_obj_key, dst_bucket, dst_obj_key, ak, sk, NULL, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(404 == resp->status_code); if (404 != resp->status_code) { printf("status code = %ld\n", resp->status_code); printf("status msg = %s\n", resp->status_msg); printf("error msg = %s\n", resp->body); } buffer_free(resp); }
/* * Create magical stairs after finishing a quest monster. */ static void build_quest_stairs(int y, int x) { int ny, nx; /* Stagger around */ while (!cave_clean_bold(y, x)) { /* Pick a location */ scatter(&ny, &nx, y, x, 5, 1); /* Stagger */ y = ny; x = nx; } /* Destroy any objects */ delete_object(y, x); /* Explain the staircase */ msg_print("A magical staircase appears..."); /* Create stairs down */ cave_set_feat(y, x, FEAT_MORE); light_spot(y, x); /* Update the visuals */ p_ptr->update |= (PU_UPDATE_VIEW | PU_MONSTERS); }
static_mem_pool_set::~static_mem_pool_set() { std::for_each(_M_memory_pool_set.rbegin(), _M_memory_pool_set.rend(), delete_object()); _STATIC_MEM_POOL_TRACE(false, "The static_mem_pool_set is destroyed"); }
bool GSDevice::Reset(int w, int h) { for_each(m_pool.begin(), m_pool.end(), delete_object()); m_pool.clear(); delete m_backbuffer; delete m_merge; delete m_weavebob; delete m_blend; delete m_shaderfx; delete m_fxaa; delete m_shadeboost; delete m_1x1; m_backbuffer = NULL; m_merge = NULL; m_weavebob = NULL; m_blend = NULL; m_shaderfx = NULL; m_fxaa = NULL; m_shadeboost = NULL; m_1x1 = NULL; m_current = NULL; // current is special, points to other textures, no need to delete return m_wnd != NULL; }
inline static void drop_object(struct aoi_space * space, struct object *obj) { --obj->ref; if (obj->ref <=0) { map_drop(space->object, obj->id); delete_object(space, obj); } }
void foo() { CValue *v; jmp_buf b; (void) setjmp(b); delete_object(v); // Move this above the setjmp and it works!!! }
static int cfs_unlink(const char *path) { if (delete_object(path)) { dir_decache(path); return 0; } return -ENOENT; }
/* * Attempt to place an object (normal or good/great) at the given location. * * This routine plays nasty games to generate the "special artifacts". * * This routine uses "object_level" for the "generation level". * * This routine requires a clean floor grid destination. */ void place_object(s32b y, s32b x, bool good, bool great, s32b where) { object_type *q_ptr; /* Paranoia -- check bounds */ if (!in_bounds(y, x)) return; /* Require clean floor space */ if (!cave_clean_bold(y, x)) return; /* Get local object */ q_ptr = make_object(good, great, NULL); /* Make an object (if possible) */ if (q_ptr == NULL) return; if (where == OBJ_FOUND_VAULT) { q_ptr->found = OBJ_FOUND_VAULT; q_ptr->found_aux1 = dungeon_type; q_ptr->found_aux2 = level_or_feat(dungeon_type, dun_level); } else if (where == OBJ_FOUND_FLOOR) { q_ptr->found = OBJ_FOUND_FLOOR; q_ptr->found_aux1 = dungeon_type; q_ptr->found_aux2 = level_or_feat(dungeon_type, dun_level); } else if (where == OBJ_FOUND_SPECIAL) { q_ptr->found = OBJ_FOUND_SPECIAL; } else if (where == OBJ_FOUND_RUBBLE) { q_ptr->found = OBJ_FOUND_RUBBLE; } /* Object array overflow */ if (!floor_carry(y, x, q_ptr)) { /* Hack -- Preserve artifacts */ if (q_ptr->artifact_id) { a_info[q_ptr->artifact_id].cur_num = 0; } else if (has_flag(&k_info[q_ptr->k_idx], FLAG_NORM_ART)) { k_info[q_ptr->k_idx].artifact = 0; } delete_object(q_ptr); } }
void func_4() { if (ENTITY::DOES_ENTITY_EXIST(iLocal_3)) { delete_object(&iLocal_3); } set_model_as_no_longer_needed(joaat("p_abat_roller_1_col")); func_5("ob_abatdoor Terminated >>>>>>>>>>>>>>>>>\n"); terminate_this_thread(); }
//----------------------------------------------------------------------- PagingLandScapePageManager::~PagingLandScapePageManager() { reset(); // could save a delete if texture type is the same... ? if (!mPagePool.empty()) { std::for_each(mPagePool.begin(), mPagePool.end(), delete_object()); mPagePool.clear(); mFreePages.clear(); } }
static int aur( scm *scmp, scmcon *conp, char what, char *valu) { char *outdir; char *outfile; char *outfull; int sta; int trusted = 0; sta = splitdf(hdir, NULL, valu, &outdir, &outfile, &outfull); if (sta != 0) { LOG(LOG_ERR, "Error loading file %s/%s: %s", hdir, valu, err2string(sta)); free((void *)outdir); free((void *)outfile); free((void *)outfull); return sta; } switch (what) { case 'a': sta = add_object(scmp, conp, outfile, outdir, outfull, trusted); break; case 'r': sta = delete_object(scmp, conp, outfile, outdir, outfull, 0); break; case 'u': (void)delete_object(scmp, conp, outfile, outdir, outfull, 0); sta = add_object(scmp, conp, outfile, outdir, outfull, trusted); break; default: break; } free((void *)outdir); free((void *)outfile); free((void *)outfull); return (sta); }
GSDevice::~GSDevice() { for_each(m_pool.begin(), m_pool.end(), delete_object()); delete m_backbuffer; delete m_merge; delete m_weavebob; delete m_blend; delete m_fxaa; delete m_1x1; }
void TEST_COPY_OBJECT_WITH_SAME_BUCKET_AND_SAME_OBJ_KEY(void) { int error; buffer* resp = NULL; const char* src_obj_key = "unit_test_dir/src_object1"; const char* filename = "./lib/libcunit.a"; resp = delete_object(host, src_bucket, src_obj_key, ak, sk, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(204 == resp->status_code || 404 == resp->status_code); buffer_free(resp); resp = upload_file_object(host, src_bucket, src_obj_key, filename, ak, sk, NULL, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(200 == resp->status_code); if (resp->status_code != 200) { printf("status code = %ld\n", resp->status_code); printf("status msg = %s\n", resp->status_msg); printf("error msg = %s\n", resp->body); } buffer_free(resp); const char* l_dst_bucket = src_bucket; const char* dst_obj_key = src_obj_key; resp = copy_object(host, src_bucket, src_obj_key, l_dst_bucket, dst_obj_key, ak, sk, NULL, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(400 == resp->status_code); if (resp->status_code != 400) { printf("status code = %ld\n", resp->status_code); printf("status msg = %s\n", resp->status_msg); printf("error msg = %s\n", resp->body); } buffer_free(resp); resp = delete_object(host, src_bucket, src_obj_key, ak, sk, NULL, &error); CU_ASSERT(0 == error); CU_ASSERT(204 == resp->status_code); buffer_free(resp); }
int main(int argc, char *argv[]) { if (aos_http_io_initialize(0) != AOSE_OK) { exit(1); } delete_object(); aos_http_io_deinitialize(); return 0; }
NTSTATUS delete_object_dir(PVOID dir) { int i; NTSTATUS ret = STATUS_SUCCESS; POBJECT_DIRECTORY_ENTRY head_entry; POBJECT_DIRECTORY_ENTRY entry; if (!dir) dir = name_space_root; if (BODY_TO_HEADER(dir)->Type != dir_object_type) return STATUS_INVALID_PARAMETER; for (i = 0; i < NUMBER_HASH_BUCKETS; i++) { head_entry = (POBJECT_DIRECTORY_ENTRY)((POBJECT_DIRECTORY)dir)->HashBuckets[i]; /* * Walk the chain of directory entries for this hash bucket, looking * for either a match, or the insertion point if no match in the chain. */ while ((entry = head_entry)) { POBJECT_HEADER header = BODY_TO_HEADER(entry->Object); POBJECT_HEADER_NAME_INFO name_info = HEADER_TO_OBJECT_NAME(header); if (name_info) name_info->Directory = NULL; if (BODY_TO_HEADER(entry->Object)->Type != dir_object_type) delete_object(header); else ret = delete_object_dir(entry->Object); head_entry = entry->ChainLink; kfree(entry); } } delete_object(BODY_TO_HEADER(dir)); return ret; } /* end delete_object_dir */
void MarkSweepGC::free_object(Entry *entry, bool fast) { if(!fast) { delete_object(entry->header->to_object()); } allocated_objects--; allocated_bytes -= entry->bytes; // A debugging tag to see if we try to use a free'd object entry->header->to_object()->IsMeta = 1; free(entry->header); }
void BakerGC::find_lost_souls() { Object* obj = current->first_object(); while(obj < current->current) { if(!obj->forwarded_p()) { delete_object(obj); #ifdef RBX_GC_STATS stats::GCStats::get()->lifetimes[obj->age]++; #endif } obj = next_object(obj); } }
int fn_thru_bullet_timer(Object * me) { me->timer--; int ox=0, oy=0; if (me->timer <= 0) { delete_object(me); return 0; } if (!strcmp(me->direction, "left")) ox = -1; if (!strcmp(me->direction, "right")) ox = 1; if (!strcmp(me->direction, "up")) oy = -1; if (!strcmp(me->direction, "down")) oy = 1; //bullet cannot go forward, delete. //this behavior peculiar to bullet. some magic may need to behave differently. if(obj_move(me->world, me, ox,oy) == 0) delete_object(me); }
void MarkSweepGC::free_object(Object* obj, bool fast) { if(!fast) { delete_object(obj); last_freed++; allocated_objects--; allocated_bytes -= obj->size_in_bytes(object_memory_->state()); } obj->set_zone(UnspecifiedZone); free(reinterpret_cast<void*>(obj)); }
void MarkSweepGC::free_object(Object* obj, bool fast) { if(!fast) { delete_object(obj); last_freed++; object_memory_->state()->metrics()->m.ruby_metrics.memory_large_objects--; object_memory_->state()->metrics()->m.ruby_metrics.memory_large_bytes -= obj->size_in_bytes(object_memory_->state()); } obj->set_zone(UnspecifiedZone); free(reinterpret_cast<void*>(obj)); }
//----------------------------------------------------------------------- void PagingLandScapeTextureManager::reset() { PagingLandScapeTexturePages::iterator iend = mTexture.end(); for (PagingLandScapeTexturePages::iterator i = mTexture.begin(); i != iend; ++i) { std::for_each( i->begin (), i->end (), delete_object()); i->clear (); } mTexture.clear(); mWidth = 0; mHeight = 0; }
void amqp_deallocate(amqp_memory_pool_t *pool, void *pooled_object) { assert(pool != null); assert(pool->destroyer_callback != null); if (pooled_object != 0) { (*pool->destroyer_callback)(pool, pooled_object); #ifdef DISABLE_MEMORY_POOL amqp_free(pooled_object TRACE_ARGS); #else delete_object(pool, pooled_object); #endif pool->stats.outstanding_allocations--; } }
void MarkSweepGC::free_object(Object* obj, bool fast) { if(!fast) { delete_object(obj); last_freed++; allocated_objects--; allocated_bytes -= obj->size_in_bytes(object_memory_->state); } obj->set_zone(UnspecifiedZone); #ifdef USE_DLMALLOC malloc_.release(reinterpret_cast<void*>(obj)); #else free(reinterpret_cast<void*>(obj)); #endif }
int fn_bomb_timer(Object * o) { o->timer -= 1; snprintf(o->shape.str, 3, "%d", o->timer); if (o->timer <= 0) { int cy, cx; for (cy = -1; cy <= 1; cy++) { for (cx = -1; cx <= 1; cx++) { new_mk_obj("fire", o->world, o->x + cx, o->y + cy, o); } } delete_object(o); } }