void QxtScheduleViewPrivate::itemGeometryChanged(QxtScheduleInternalItem * item, QVector< QRect > oldGeometry) { QRegion oldRegion; if (item->geometry() == oldGeometry) return; QVectorIterator<QRect> iter(oldGeometry); QRect currRect; while (iter.hasNext()) { currRect = iter.next(); currRect.adjust(-1, -1, 2, 2); oldRegion += currRect; } //viewport()->update(oldRegion); QRegion newRegion; QVectorIterator<QRect> newIter(item->geometry()); while (newIter.hasNext()) { currRect = newIter.next(); currRect.adjust(-1, -1, 2, 2); newRegion += currRect; } //viewport()->update(newRegion); qxt_p().viewport()->update(); }
// ------------------------------------------------------------ Print operands stack void printAnds( const Stack Ands ) { Iter si = newIter( Ands ); printf( "\nStack has %d items: bottom<[ ", sizeStack( Ands ) ); while (hasNextIter( si )) { printOperand( nextIter( si ) ); } printf( " ]>top\n" ); freeIter( si ); }
static btSIter *getIterator() { pthread_mutex_lock (&g_iter_lock); // -->>>>>>>>>>>>>>>> LOCK if (!IterList) { IterList = cf_malloc(sizeof(cf_ll)); cf_ll_init(IterList, NULL, false); } btSIter *siter; cf_ll_element * ele = IterList->head; if (!ele) siter = newIter(); else { siter = ((ll_btSIter_element *)ele)->value; cf_ll_delete(IterList, ele); cf_free(ele); } // LPOP pthread_mutex_unlock(&g_iter_lock); // <<<<<<<<<<<<<<<<-- UNLOCK return siter; }
instPoint *instPoint::createArbitraryInstPoint(Address addr, process *proc) { // See if we get lucky int_function *func = proc->findFuncByAddr(addr); // TODO: multiple functions... if (!func) return NULL; inst_printf("Creating arbitrary point at 0x%x\n", addr); instPoint *newIP = func->findInstPByAddr(addr); if (newIP) return newIP; // Check to see if we're creating the new instPoint on an // instruction boundary. First, get the instance... bblInstance *bbl = func->findBlockInstanceByAddr(addr); if (!bbl) { inst_printf("Address not in known code, ret null\n"); fprintf(stderr, "%s[%d]: Address not in known code, ret null\n", FILE__, __LINE__); return NULL; } int_basicBlock *block = bbl->block(); assert(block); // Some blocks cannot be relocated; since instrumentation requires // relocation of the block, don't even bother. if(!block->llb()->canBeRelocated()) { inst_printf("Address is in unrelocatable block, ret null\n"); return NULL; } // For now: we constrain the address to be in the original instance // of the basic block. if (block->origInstance() != bbl) { fprintf(stderr, "%s[%d]: Address not in original basic block instance\n", FILE__, __LINE__); return NULL; } InstrucIter newIter(bbl); while ((*newIter) < addr) newIter++; if (*newIter != addr) { inst_printf("Unaligned try for instruction iterator, ret null\n"); fprintf(stderr, "%s[%d]: Unaligned try for instruction iterator, ret null\n", FILE__, __LINE__); return NULL; // Not aligned } #if defined(arch_sparc) // Can't instrument delay slots if (newIter.hasPrev()) { if (newIter.getPrevInstruction().isDCTI()) { inst_printf("%s[%d]: can't instrument delay slot\n", FILE__, __LINE__); fprintf(stderr, "%s[%d]: can't instrument delay slot\n", FILE__, __LINE__); return NULL; } } #endif newIP = new instPoint(proc, newIter.getInstruction(), addr, block); if (!commonIPCreation(newIP)) { delete newIP; inst_printf("Failed common IP creation, ret null\n"); return NULL; } func->addArbitraryPoint(newIP); return newIP; }
static btSIter *getIterator() { return newIter(); }
CFGIterator CFGIterator::begin(const CFGNode n) { CFGIterator newIter(n); return newIter; }
iterator iterator::begin(DataflowNode n) { iterator newIter(n); return newIter; }
// PD_TRACE_DECLARE_FUNCTION ( COORD_GETINDEX_GENRESULT, "_coordCMDGetIndexes::generateResult" ) INT32 _coordCMDGetIndexes::generateResult( rtnContext *pContext, pmdEDUCB *cb ) { INT32 rc = SDB_OK ; PD_TRACE_ENTRY ( COORD_GETINDEX_GENRESULT ) ; CoordIndexMap indexMap ; rtnContextBuf buffObj ; while( TRUE ) { rc = pContext->getMore( 1, buffObj, cb ) ; if ( rc ) { if ( SDB_DMS_EOC == rc ) { rc = SDB_OK ; break ; } else { PD_LOG ( PDERROR, "Failed to get index data, rc: %d", rc ) ; goto error ; } } try { BSONObj boTmp( buffObj.data() ) ; BSONObj boIndexDef ; BSONElement ele ; string strIndexName ; CoordIndexMap::iterator iter ; ele = boTmp.getField( IXM_FIELD_NAME_INDEX_DEF ) ; PD_CHECK ( ele.type() == Object, SDB_INVALIDARG, error, PDERROR, "Failed to get the field(%s)", IXM_FIELD_NAME_INDEX_DEF ) ; boIndexDef = ele.embeddedObject() ; ele = boIndexDef.getField( IXM_NAME_FIELD ) ; PD_CHECK ( ele.type() == String, SDB_INVALIDARG, error, PDERROR, "Failed to get the field(%s)", IXM_NAME_FIELD ) ; strIndexName = ele.valuestr() ; iter = indexMap.find( strIndexName ) ; if ( indexMap.end() == iter ) { indexMap[ strIndexName ] = boTmp.getOwned() ; } else { BSONObjIterator newIter( boIndexDef ) ; BSONObj boOldDef ; ele = iter->second.getField( IXM_FIELD_NAME_INDEX_DEF ) ; PD_CHECK ( ele.type() == Object, SDB_INVALIDARG, error, PDERROR, "Failed to get the field(%s)", IXM_FIELD_NAME_INDEX_DEF ) ; boOldDef = ele.embeddedObject() ; BSONElement beTmp1, beTmp2 ; while( newIter.more() ) { beTmp1 = newIter.next() ; if ( 0 == ossStrcmp( beTmp1.fieldName(), "_id" ) ) { continue ; } beTmp2 = boOldDef.getField( beTmp1.fieldName() ) ; if ( 0 != beTmp1.woCompare( beTmp2 ) ) { PD_LOG( PDWARNING, "Corrupted index(name:%s, define1:%s, " "define2:%s)", strIndexName.c_str(), boIndexDef.toString().c_str(), boOldDef.toString().c_str() ) ; break ; } } } } catch ( std::exception &e ) { PD_RC_CHECK( rc, PDERROR, "Failed to get index, occured unexpected" "error:%s", e.what() ) ; } } { CoordIndexMap::iterator iterMap = indexMap.begin(); while( iterMap != indexMap.end() ) { rc = pContext->append( iterMap->second ) ; PD_RC_CHECK( rc, PDERROR, "Failed to get index, append the data " "failed(rc=%d)", rc ) ; ++iterMap ; } } done: PD_TRACE_EXITRC ( COORD_GETINDEX_GENRESULT, rc ) ; return rc ; error: goto done ; }