SET setXIntersect(SET A,SET B) { SET set; void *e; if (! (A->cmp && B->cmp) ) return NULL; /* Both need a compare function */ /* Create new set */ if (! (set = setNew(A->cmp,A->ed,A->ord))) { XLOG(set); return NULL; } /* Add elements of A only */ for (e = setFirst(A); e; e = setNext(A)) if (!setContains(B,e)) setAdd(set,e); /* Add elements of B only */ for (e = setFirst(B); e; e = setNext(B)) if (!setContains(A,e)) setAdd(set,e); return set; }
/* * Calculates and returns the set theoretic union of two sets. A union creates a set whose elements * are all elements from setA and all elements from setB. For this to work, the two sets should * contain the same type of elements and the comparison functions for setA and setB should be * functionally equivalent as well. * * Arguments: * setA -- The first set in the pair of sets to union * setB -- The second set in the pair of sets to union * comparisonfunction -- A function to compare the elements in the union. If this is NULL, the * comparison function from setA will be used. * * Returns: * A set containing all non-equivalent elements from setA and setB. */ Set *setUnion( Set *setA, Set *setB, ComparisonFunction comparisonFunction ) { // Ensure that the proper comparison function gets used if( ! comparisonFunction ) { comparisonFunction = setA->elements->comparisonFunction; } // Get the elements from A & B, create a new Set void **elementsA = bstElements( setA->elements ); void **elementsB = bstElements( setB->elements ); Set *unionResult = newSet( comparisonFunction ); // Insert the elements from A into the set for( int i = 0; i < setA->size; i++ ) { setAdd( unionResult, elementsA[i] ); } // Insert the elements from B into the set for( int i = 0; i < setB->size; i++ ) { setAdd( unionResult, elementsB[i] ); } // Free the structure from the element vectors free( elementsA ); free( elementsB ); return unionResult; }
//----------------------------------------------------------------------------- // // calcLastPos. Impossible to explain succinctly. See Aho, section 3.9 // //----------------------------------------------------------------------------- void RBBITableBuilder::calcLastPos(RBBINode *n) { if (n == NULL) { return; } if (n->fType == RBBINode::leafChar || n->fType == RBBINode::endMark || n->fType == RBBINode::lookAhead || n->fType == RBBINode::tag) { // These are non-empty leaf node types. n->fLastPosSet->addElement(n, *fStatus); return; } // The node is not a leaf. // Calculate lastPos on its children. calcLastPos(n->fLeftChild); calcLastPos(n->fRightChild); // Apply functions from table 3.40 in Aho if (n->fType == RBBINode::opOr) { setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); setAdd(n->fLastPosSet, n->fRightChild->fLastPosSet); } else if (n->fType == RBBINode::opCat) { setAdd(n->fLastPosSet, n->fRightChild->fLastPosSet); if (n->fRightChild->fNullable) { setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); } } else if (n->fType == RBBINode::opStar || n->fType == RBBINode::opQuestion || n->fType == RBBINode::opPlus) { setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); } }
void JabberAdd::setBrowser(bool bBrowser) { if (m_bBrowser == bBrowser) return; m_bBrowser = bBrowser; if (m_bBrowser && (m_browser == NULL)){ m_browser = new JabberBrowser; emit addResult(m_browser); m_browser->setClient(m_client); connect(m_browser, SIGNAL(destroyed()), this, SLOT(browserDestroyed())); } emit showResult(m_bBrowser ? m_browser : NULL); const QIconSet *is = Icon(m_bBrowser ? "1leftarrow" : "1rightarrow"); if (is) btnBrowser->setIconSet(*is); if (m_bBrowser){ edtJID->setEnabled(false); edtMail->setEnabled(false); edtFirst->setEnabled(false); edtLast->setEnabled(false); edtNick->setEnabled(false); lblFirst->setEnabled(false); lblLast->setEnabled(false); lblNick->setEnabled(false); emit setAdd(false); }else{ m_btnJID->slotToggled(m_btnJID->isChecked()); m_btnName->slotToggled(m_btnName->isChecked()); m_btnMail->slotToggled(m_btnMail->isChecked()); } }
void JabberAdd::showEvent(QShowEvent *e) { JabberAddBase::showEvent(e); emit setAdd(m_btnJID->isChecked()); if (m_browser && m_bBrowser) emit showResult(m_browser); }
void JabberAdd::setBrowser(bool bBrowser) { if (m_bBrowser == bBrowser) return; m_bBrowser = bBrowser; if (m_bBrowser && (m_browser == NULL)){ m_browser = new JabberBrowser; emit addResult(m_browser); m_browser->setClient(m_client); connect(m_browser, SIGNAL(destroyed()), this, SLOT(browserDestroyed())); } emit showResult(m_bBrowser ? m_browser : NULL); QIconSet is = Icon(m_bBrowser ? "1leftarrow" : "1rightarrow"); if (!is.pixmap(QIconSet::Small, QIconSet::Normal).isNull()) btnBrowser->setIconSet(is); if (m_bBrowser){ edtJID->setEnabled(false); edtMail->setEnabled(false); edtFirst->setEnabled(false); edtLast->setEnabled(false); edtNick->setEnabled(false); lblFirst->setEnabled(false); lblLast->setEnabled(false); lblNick->setEnabled(false); emit setAdd(false); }else{ grpJID->slotToggled(); grpName->slotToggled(); grpMail->slotToggled(); } }
// Goes over the list of nodes that needs to be freed // and frees them if no HP points at them. void scan(HPLocal localData) { int i; //Stage 1: scan HP list and insert non-null values to plist Set plist = localData->plist; setReset(plist); HPRecord* curr = localData->HPRecHead; while (curr != NULL) { for (i = 0; i < localData->hpData->HP_COUNT; i++) { if (curr->hp[i] != NULL) { setAdd(plist, (long) (curr->hp[i])); } } curr = curr->next; } //Stage 2: search plist //uses two stacks instead of allocating a new one each time scan() is called SwapStacks(&localData->rlist, &localData->temp); stackReset(localData->rlist); ReclaimationData* recData = stackPop(localData->temp); while (recData != NULL) { if (setContains(plist, (long) recData->address)) { stackPush(localData->rlist, recData->address, recData->reclaimationFunc); } else { (*((ReclaimationFunc*)recData->reclaimationFunc))(recData->address); } recData = stackPop(localData->temp); } setReset(plist); }
//----------------------------------------------------------------------------- // // calcLastPos. Impossible to explain succinctly. See Aho, section 3.9 // //----------------------------------------------------------------------------- void RBBITableBuilder::calcLastPos(RBBINode * n) { if (n == NULL) { return; } if (n->fType == RBBINode::leafChar || n->fType == RBBINode::endMark || n->fType == RBBINode::lookAhead || n->fType == RBBINode::tag) { // These are non-empty leaf node types. // Note: In order to maintain the sort invariant on the set, // this function should only be called on a node whose set is // empty to start with. n->fLastPosSet->addElement(n, *fStatus); return; } // The node is not a leaf. // Calculate lastPos on its children. calcLastPos(n->fLeftChild); calcLastPos(n->fRightChild); // Apply functions from table 3.40 in Aho if (n->fType == RBBINode::opOr) { setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); setAdd(n->fLastPosSet, n->fRightChild->fLastPosSet); } else if (n->fType == RBBINode::opCat) { setAdd(n->fLastPosSet, n->fRightChild->fLastPosSet); if (n->fRightChild->fNullable) { setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); } } else if (n->fType == RBBINode::opStar || n->fType == RBBINode::opQuestion || n->fType == RBBINode::opPlus) { setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); } }
//----------------------------------------------------------------------------- // // calcFollowPos. Impossible to explain succinctly. See Aho, section 3.9 // //----------------------------------------------------------------------------- void RBBITableBuilder::calcFollowPos(RBBINode * n) { if (n == NULL || n->fType == RBBINode::leafChar || n->fType == RBBINode::endMark) { return; } calcFollowPos(n->fLeftChild); calcFollowPos(n->fRightChild); // Aho rule #1 if (n->fType == RBBINode::opCat) { RBBINode * i; // is 'i' in Aho's description uint32_t ix; UVector * LastPosOfLeftChild = n->fLeftChild->fLastPosSet; for (ix = 0; ix < (uint32_t)LastPosOfLeftChild->size(); ix++) { i = (RBBINode *)LastPosOfLeftChild->elementAt(ix); setAdd(i->fFollowPos, n->fRightChild->fFirstPosSet); } } // Aho rule #2 if (n->fType == RBBINode::opStar || n->fType == RBBINode::opPlus) { RBBINode * i; // again, n and i are the names from Aho's description. uint32_t ix; for (ix = 0; ix < (uint32_t)n->fLastPosSet->size(); ix++) { i = (RBBINode *)n->fLastPosSet->elementAt(ix); setAdd(i->fFollowPos, n->fFirstPosSet); } } }
SET setUnion1(SET s1,SET s2) { SET set; void *e; set = setNew(s1->cmp,s1->ed,s1->ord); if (!set) { XLOG(set); return NULL; } for (e = setFirst(s1); e; e = setNext(s1)) setAdd(set,e); /* Blind copy of s1 */ for (e = setFirst(s2); e; e = setNext(s2)) setAdd(set,e); /* Call setAdd() to weed out duplicates */ return set; }
static int add_alloc_set(int context, int type, unsigned int val) { int i, retval = 0; for(i = 0; i < MAX_CONTEXT; i++) if(global_ppriv[i].used && global_ppriv[i].context == context){ retval = setAdd(global_ppriv[i].sets[type], val); break; } return retval; }
SET setUnion(SET set1,SET set2) { void *e; /* Add all elements of set2 onto set1 */ for (e = setFirst(set2); e; e = setNext(set2)) setAdd(set1,e); return set1; }
/* * Calculates the set theoretic intersection of two sets. An intersection creates a set whose * elements are present in setA AND present in setB. For this to work, the two sets should * contain the same type of elements and the comparison functions for setA and setB should be * functionally equivalent as well. * * Arguments: * setA -- The first set in the pair of sets to intersection * setB -- The second set in the pair of sets to intersection * comparisonfunction -- A function to compare the elements in the union. If this is NULL, the * comparison function from setA will be used. * * Returns: * A set containing all elements present in both sets. */ Set *setIntersect( Set *setA, Set *setB, ComparisonFunction comparisonFunction ) { // Ensure that the proper comparison function gets used if( ! comparisonFunction ) { comparisonFunction = setA->elements->comparisonFunction; } Set *intersectionResult = newSet( comparisonFunction ); // Iterate over the smaller set if( setA->size <= setB->size ) { void **elements = bstElements( setA->elements ); for( int i = 0; i < setA->size; i++ ) { void *element = elements[i]; // If the element is in both sets, add it if( isInSet( setB, element ) ) { setAdd( intersectionResult, element ); } } free( elements ); } else { void **elements = bstElements( setB->elements ); for( int i = 0; i < setB->size; i++ ) { void *element = elements[i]; // If the element is in both sets, add it if( isInSet( setA, element ) ) { setAdd( intersectionResult, element ); } } free( elements ); } return intersectionResult; }
//----------------------------------------------------------------------------- // // bofFixup. Fixup for state tables that include {bof} beginning of input testing. // Do an swizzle similar to chaining, modifying the followPos set of // the bofNode to include the followPos nodes from other {bot} nodes // scattered through the tree. // // This function has much in common with calcChainedFollowPos(). // //----------------------------------------------------------------------------- void RBBITableBuilder::bofFixup() { if (U_FAILURE(*fStatus)) { return; } // The parse tree looks like this ... // fTree root ---> <cat> // / \ . // <cat> <#end node> // / \ . // <bofNode> rest // of tree // // We will be adding things to the followPos set of the <bofNode> // RBBINode * bofNode = fTree->fLeftChild->fLeftChild; U_ASSERT(bofNode->fType == RBBINode::leafChar); U_ASSERT(bofNode->fVal == 2); // Get all nodes that can be the start a match of the user-written rules // (excluding the fake bofNode) // We want the nodes that can start a match in the // part labeled "rest of tree" // UVector * matchStartNodes = fTree->fLeftChild->fRightChild->fFirstPosSet; RBBINode * startNode; int startNodeIx; for (startNodeIx = 0; startNodeIx < matchStartNodes->size(); startNodeIx++) { startNode = (RBBINode *)matchStartNodes->elementAt(startNodeIx); if (startNode->fType != RBBINode::leafChar) { continue; } if (startNode->fVal == bofNode->fVal) { // We found a leaf node corresponding to a {bof} that was // explicitly written into a rule. // Add everything from the followPos set of this node to the // followPos set of the fake bofNode at the start of the tree. // setAdd(bofNode->fFollowPos, startNode->fFollowPos); } } }
set* computeFirstSets(int id, prodRuleNode** rulelist, set** firststs) { if(isTerminal(id)) { set* st = createEmptySet(); st->val = id; return st; } if(firststs[id] != NULL) return firststs[id]; set* st = NULL; prodRuleNode* p = rulelist[id]; int i, j; for (i = 0; i < p->prod_rule_cnt; ++i) { if(p->prod_rules[i][0] == TK_EPS) { st = setAdd(TK_EPS, st); continue; } bool flag = false; for (j = 0; j < p->rule_length[i]; ++j) { set* st2 = computeFirstSets(p->prod_rules[i][j], rulelist, firststs); st = setUnion(st, st2); if(!isPresent(TK_EPS, st2)) { flag = true; break; } } if(!flag) st = setAdd(TK_EPS, st); } firststs[id] = st; return st; }
SearchDialog::SearchDialog() { SET_WNDPROC("search") setIcon(Pict("find")); setButtonsPict(this); setCaption(i18n("Search")); m_current = NULL; m_currentResult = NULL; m_bAdd = true; m_id = 0; m_result_id = 0; m_active = NULL; m_search = new SearchBase(this); m_update = new QTimer(this); connect(m_update, SIGNAL(timeout()), this, SLOT(update())); setCentralWidget(m_search); m_status = statusBar(); m_result = NULL; setAdd(false); m_search->btnOptions->setIconSet(Icon("1downarrow")); m_search->btnAdd->setIconSet(Icon("add")); m_search->btnNew->setIconSet(Icon("new")); connect(m_search->wndCondition, SIGNAL(aboutToShow(QWidget*)), this, SLOT(aboutToShow(QWidget*))); connect(m_search->wndResult, SIGNAL(aboutToShow(QWidget*)), this, SLOT(resultShow(QWidget*))); fillClients(); connect(m_search->cmbClients, SIGNAL(activated(int)), this, SLOT(clientActivated(int))); m_result = new ListView(m_search->wndResult); m_result->addColumn(i18n("Results")); m_result->setShowSortIndicator(true); m_result->setExpandingColumn(0); m_result->setFrameShadow(QFrame::Sunken); m_result->setLineWidth(1); addResult(m_result); showResult(NULL); aboutToShow(m_search->wndCondition->visibleWidget()); connect(m_search->btnSearch, SIGNAL(clicked()), this, SLOT(searchClick())); m_search->cmbClients->setFocus(); connect(m_search->btnOptions, SIGNAL(clicked()), this, SLOT(optionsClick())); connect(m_search->btnAdd, SIGNAL(clicked()), this, SLOT(addClick())); m_search->btnOptions->setEnabled(false); m_search->btnAdd->setEnabled(false); connect(m_result, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(m_result, SIGNAL(dragStart()), this, SLOT(dragStart())); connect(m_search->btnNew, SIGNAL(clicked()), this, SLOT(newSearch())); m_result->setMenu(MenuSearchItem); resultShow(m_result); }
/* * Creates a new set where the elements in the set derived by applying the map function to every * element in the set passed to the function * * Arguments: * set -- The set whose elements will be mapped over * function -- The function that will be applied to every element in the set. This * function should allocate new space for the result rather than overwrite the * space already present. * comparisonfunction -- A function that can be used to compare elements in the codomain of the * mapping function. This can safely be set to NULL if it is known that the * codomain is the set as the domain of the mapping function. If this is NULL * and the codomain is different, the behavior is unspecified and could lead * to errors and crashes depending on the nature of the original set's * comparison function. * * Returns: * A new set containing every element within the original set after the function has been applied. */ Set *setMap( Set *set, MapFunction function, ComparisonFunction comparisonFunction) { if( ! comparisonFunction ) { comparisonFunction = set->elements->comparisonFunction; } // Create the new set and get the elements from the old set Set *result = newSet( comparisonFunction ); void **elements = bstElements( set->elements ); // Apply the function to each element in the old set, then add it to the new set for( int i = 0; i < set->size; i++ ) { void *element = function( elements[i] ); setAdd( result, element ); } free( elements ); return result; }
SET setDifference(SET A,SET B) { SET set; void *e; if ( ! B->cmp) return NULL; /* B needs a compare function */ /* Create the resulting set */ set = setNew(A->cmp,A->ed,A->ord); if (!set) { XLOG(set); return NULL; } for (e = setFirst(A); e; e = setNext(A)) if (!setContains(B,e)) setAdd(set,e); return set; }
SET setIntersect(SET s1,SET s2) { SET set; void *e; /* At least one of the sets must have a compare function */ if ( ! (s1->cmp || s2->cmp) ) return NULL; /* Create a disjoint set */ set = setNew(s1->cmp ? s1->cmp : s2->cmp,1,s1->ord); if (!set) { XLOG(set); return NULL; } for (e = setFirst(s1); e; e = setNext(s1)) { if (setContains(s2,e)) setAdd(set,e); } return set; }
void NonIM::showEvent(QShowEvent *e) { NonIMBase::showEvent(e); emit setAdd(true); }
//----------------------------------------------------------------------------- // // buildStateTable() Determine the set of runtime DFA states and the // transition tables for these states, by the algorithm // of fig. 3.44 in Aho. // // Most of the comments are quotes of Aho's psuedo-code. // //----------------------------------------------------------------------------- void RBBITableBuilder::buildStateTable() { if (U_FAILURE(*fStatus)) { return; } // // Add a dummy state 0 - the stop state. Not from Aho. int lastInputSymbol = fRB->fSetBuilder->getNumCharCategories() - 1; RBBIStateDescriptor *failState = new RBBIStateDescriptor(lastInputSymbol, fStatus); failState->fPositions = new UVector(*fStatus); if (U_FAILURE(*fStatus)) { return; } fDStates->addElement(failState, *fStatus); if (U_FAILURE(*fStatus)) { return; } // initially, the only unmarked state in Dstates is firstpos(root), // where toot is the root of the syntax tree for (r)#; RBBIStateDescriptor *initialState = new RBBIStateDescriptor(lastInputSymbol, fStatus); if (U_FAILURE(*fStatus)) { return; } initialState->fPositions = new UVector(*fStatus); if (U_FAILURE(*fStatus)) { return; } setAdd(initialState->fPositions, fTree->fFirstPosSet); fDStates->addElement(initialState, *fStatus); if (U_FAILURE(*fStatus)) { return; } // while there is an unmarked state T in Dstates do begin for (;;) { RBBIStateDescriptor *T = NULL; int32_t tx; for (tx=1; tx<fDStates->size(); tx++) { RBBIStateDescriptor *temp; temp = (RBBIStateDescriptor *)fDStates->elementAt(tx); if (temp->fMarked == FALSE) { T = temp; break; } } if (T == NULL) { break; } // mark T; T->fMarked = TRUE; // for each input symbol a do begin int32_t a; for (a = 1; a<=lastInputSymbol; a++) { // let U be the set of positions that are in followpos(p) // for some position p in T // such that the symbol at position p is a; UVector *U = NULL; RBBINode *p; int32_t px; for (px=0; px<T->fPositions->size(); px++) { p = (RBBINode *)T->fPositions->elementAt(px); if ((p->fType == RBBINode::leafChar) && (p->fVal == a)) { if (U == NULL) { U = new UVector(*fStatus); } setAdd(U, p->fFollowPos); } } // if U is not empty and not in DStates then int32_t ux = 0; UBool UinDstates = FALSE; if (U != NULL) { U_ASSERT(U->size() > 0); int ix; for (ix=0; ix<fDStates->size(); ix++) { RBBIStateDescriptor *temp2; temp2 = (RBBIStateDescriptor *)fDStates->elementAt(ix); if (setEquals(U, temp2->fPositions)) { delete U; U = temp2->fPositions; ux = ix; UinDstates = TRUE; break; } } // Add U as an unmarked state to Dstates if (!UinDstates) { RBBIStateDescriptor *newState = new RBBIStateDescriptor(lastInputSymbol, fStatus); if (U_FAILURE(*fStatus)) { return; } newState->fPositions = U; fDStates->addElement(newState, *fStatus); if (U_FAILURE(*fStatus)) { return; } ux = fDStates->size()-1; } // Dtran[T, a] := U; T->fDtran->setElementAt(ux, a); } } } }
//----------------------------------------------------------------------------- // // calcChainedFollowPos. Modify the previously calculated followPos sets // to implement rule chaining. NOT described by Aho // //----------------------------------------------------------------------------- void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree) { UVector endMarkerNodes(*fStatus); UVector leafNodes(*fStatus); int32_t i; if (U_FAILURE(*fStatus)) { return; } // get a list of all endmarker nodes. tree->findNodes(&endMarkerNodes, RBBINode::endMark, *fStatus); // get a list all leaf nodes tree->findNodes(&leafNodes, RBBINode::leafChar, *fStatus); if (U_FAILURE(*fStatus)) { return; } // Get all nodes that can be the start a match, which is FirstPosition() // of the portion of the tree corresponding to user-written rules. // See the tree description in bofFixup(). RBBINode *userRuleRoot = tree; if (fRB->fSetBuilder->sawBOF()) { userRuleRoot = tree->fLeftChild->fRightChild; } U_ASSERT(userRuleRoot != NULL); UVector *matchStartNodes = userRuleRoot->fFirstPosSet; // Iteratate over all leaf nodes, // int32_t endNodeIx; int32_t startNodeIx; for (endNodeIx=0; endNodeIx<leafNodes.size(); endNodeIx++) { RBBINode *tNode = (RBBINode *)leafNodes.elementAt(endNodeIx); RBBINode *endNode = NULL; // Identify leaf nodes that correspond to overall rule match positions. // These include an endMarkerNode in their followPos sets. for (i=0; i<endMarkerNodes.size(); i++) { if (tNode->fFollowPos->contains(endMarkerNodes.elementAt(i))) { endNode = tNode; break; } } if (endNode == NULL) { // node wasn't an end node. Try again with the next. continue; } // We've got a node that can end a match. // Line Break Specific hack: If this node's val correspond to the $CM char class, // don't chain from it. // TODO: Add rule syntax for this behavior, get specifics out of here and // into the rule file. if (fRB->fLBCMNoChain) { UChar32 c = this->fRB->fSetBuilder->getFirstChar(endNode->fVal); if (c != -1) { // c == -1 occurs with sets containing only the {eof} marker string. ULineBreak cLBProp = (ULineBreak)u_getIntPropertyValue(c, UCHAR_LINE_BREAK); if (cLBProp == U_LB_COMBINING_MARK) { continue; } } } // Now iterate over the nodes that can start a match, looking for ones // with the same char class as our ending node. RBBINode *startNode; for (startNodeIx = 0; startNodeIx<matchStartNodes->size(); startNodeIx++) { startNode = (RBBINode *)matchStartNodes->elementAt(startNodeIx); if (startNode->fType != RBBINode::leafChar) { continue; } if (endNode->fVal == startNode->fVal) { // The end val (character class) of one possible match is the // same as the start of another. // Add all nodes from the followPos of the start node to the // followPos set of the end node, which will have the effect of // letting matches transition from a match state at endNode // to the second char of a match starting with startNode. setAdd(endNode->fFollowPos, startNode->fFollowPos); } } } }
void JabberAdd::radioToggled(bool) { setBrowser(false); if (isVisible()) emit setAdd(grpJID->isChecked()); }
void JournalSearch::showEvent(QShowEvent *e) { JournalSearchBase::showEvent(e); emit setAdd(true); }
void MSNSearch::radioToggled(bool) { emit setAdd(m_btnMail->isChecked()); }
void MSNSearch::showEvent(QShowEvent *e) { MSNSearchBase::showEvent(e); emit setAdd(m_btnMail->isChecked()); }
valType dbGC(void) { valType collected = 0, i; dictIterator *iter = NULL; dictEntry *entry = NULL; set *acc = NULL; lockWrite(objectIndex); lockRead(sets); // Step 1. Union all sets in db. if (NULL == (iter = dictGetIterator(sets))) { unlockRead(sets); unlockWrite(objectIndex); return 0; } if (NULL == (acc = setCreate())) { unlockRead(sets); unlockWrite(objectIndex); return 0; } while (NULL != (entry = dictNext(iter))) { valType currentSetId = 0; set *tmp = NULL, *currentSet = (set *) dictGetEntryVal(entry); set *flattened = setFlatten(currentSet, 0); if (NULL == flattened) { continue; } if (1 == dbFindSet(currentSet, ¤tSetId, 0)) { if (-1 == setAdd(acc, currentSetId)) { setDestroy(acc); dictReleaseIterator(iter); unlockRead(sets); unlockWrite(objectIndex); return 0; } } if (NULL == (tmp = setUnion(acc, flattened))) { setDestroy(flattened); setDestroy(acc); dictReleaseIterator(iter); unlockRead(sets); unlockWrite(objectIndex); return 0; } setDestroy(flattened); setDestroy(acc); acc = tmp; } dictReleaseIterator(iter); // Step 2. Find objects not present in grand total union. for (i = 0; i < objectIndexLength; i++) { if (NULL != objectIndex[i] && !setIsMember(acc, i)) { dbObjectRelease((dbObject *) objectIndex[i]); free((dbObject *) objectIndex[i]); objectIndex[i] = NULL; if (i < objectIndexFreeId) { objectIndexFreeId = i; } collected++; } } setDestroy(acc); unlockRead(sets); unlockWrite(objectIndex); return collected; }
void MSNSearch::showEvent(QShowEvent *e) { MSNSearchBase::showEvent(e); emit setAdd(true); }
void JabberAdd::radioToggled(bool) { setBrowser(false); emit setAdd(m_btnJID->isChecked()); }
void SearchAll::showEvent(QShowEvent *e) { SearchAllBase::showEvent(e); emit setAdd(false); }