这篇教程C++ FreeNode函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FreeNode函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeNode函数的具体用法?C++ FreeNode怎么用?C++ FreeNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FreeNode函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Insert2ListE_BOOL_TYPE Insert2List(PT_NODE ptHeadNode, char* tagName, char* content){ PT_NODE ptNode = NULL; PT_NODE ptFirst = NULL; ptNode = (PT_NODE) malloc(sizeof(T_NODE)); if ( ptNode == NULL ) { return FAIL; } ptNode->tagName = (char*)dupstr(tagName); if ( !ptNode->tagName ) { FreeNode(&ptNode); return FAIL; } ptNode->content = (char*)dupstr(content); if ( !ptNode->content ) { FreeNode(&ptNode); return FAIL; } ptFirst = ptHeadNode->next; ptHeadNode->next = ptNode; ptNode->next = ptFirst; return SUCCESS;}
开发者ID:fanqingsong,项目名称:code-snippet,代码行数:31,
示例2: FreeNode/*** FreeNode() recursively frees a given node.*/void FreeNode(node *n) { if (n->type != TGEN && n->type != TNUM) { FreeNode(n->cont.op.l); FreeNode(n->cont.op.r); } Free(n);}
开发者ID:gap-packages,项目名称:nq,代码行数:10,
示例3: MulNODE * Mul( NODE *n1, NODE *n2 ){ if( n1 == 0 ) return n2; if( n2 == 0 ) return n1; if( IsConst( n1, 1 ) ) { n2->sign *= n1->sign; FreeNode( n1 ); return n2; } if( IsConst( n2, 1 ) ) { n2->sign *= n1->sign; FreeNode( n2 ); return n1; } if( IsConst( n1, 0 ) ) { FreeNode( n2 ); return n1; } if( IsConst( n2, 0 ) ) { FreeNode( n1 ); return n2; } return BinaryOp( MUL, n1, n2 ); }
开发者ID:CEKrause,项目名称:WRFV_3.7.1,代码行数:26,
示例4: MergeList/** * 算法2.21 */Status MergeList(LinkList &La, LinkList &Lb, LinkList &Lc, int (*compare)(ElemType, ElemType)){ Link ha, hb, pa, pb, q; ElemType a, b; if (!InitList(Lc)) return ERROR; ha = GetHead(La); hb = GetHead(Lb); pa = NextPos(La, ha); pb = NextPos(Lb, hb); while (pa && pb) { a = GetCurElem(pa); b = GetCurElem(pb); if (compare(a, b) <= 0) { // a<=b DelFirst(ha, q); Append(Lc, q); pa = NextPos(La, ha); } else { // a>b DelFirst(hb, q); Append(Lc, q); pb = NextPos(Lb, hb); } } // while if (pa) Append(Lc, pa); else Append(Lc, pb); FreeNode(ha); FreeNode(hb); return OK;}
开发者ID:Annie2333,项目名称:DS_Code,代码行数:35,
示例5: RmSubstvoid RmSubst( NODE *n ){NODE *pn;NODE *cn; pn = 0; cn = substList; while( cn != 0 ) { if( NodeCmp( n, cn ) ) break; pn = cn; cn = cn->left; } if( cn == 0 ) return; FreeNode( cn->right ); if( pn ) pn->left = cn->left; else substList = cn->left; cn->right = 0; cn->left = 0; FreeNode( cn );}
开发者ID:CEKrause,项目名称:WRFV_3.7.1,代码行数:25,
示例6: DeleteItem //************************************************ // 删除一个节点,可以被派生类重载 //*********************************************** virtual void DeleteItem(HSTREEITEM hItem) { HSTREENODE hsNode= (HSTREENODE)hItem; DUIASSERT(hsNode); if(hsNode==STVN_ROOT) { FreeNode(STVN_ROOT); m_hRootFirst=NULL; m_hRootLast=NULL; return; } STREENODE nodeCopy=*hsNode; BOOL bRootFirst=hsNode==m_hRootFirst; BOOL bRootLast=hsNode==m_hRootLast; FreeNode(hsNode); if(nodeCopy.hPrevSibling)//has prevsibling nodeCopy.hPrevSibling->hNextSibling=nodeCopy.hNextSibling; else if(nodeCopy.hParent)//parent's first child nodeCopy.hParent->hChildFirst=nodeCopy.hNextSibling; if(nodeCopy.hNextSibling)// update next sibling's previous sibling nodeCopy.hNextSibling->hPrevSibling=nodeCopy.hPrevSibling; else if(nodeCopy.hParent)//parent's last child nodeCopy.hParent->hChildLast=nodeCopy.hPrevSibling; //update root item if(bRootFirst) m_hRootFirst=nodeCopy.hNextSibling; if(bRootLast) m_hRootLast=nodeCopy.hPrevSibling; }
开发者ID:azunite,项目名称:duiengine,代码行数:31,
示例7: SortPolynvoid SortPolyn(polynomail *p) { Link *p1, *p2; //采用直接插入排序 for (p1 = p->head->next; p1; p1 = p1->next) { for (p2 = p->head->next; p2 != p1; p2 = p2->next) { if (p2->data->expn == p1->data->expn) { //若后边待排序的节点的指数跟前面已排序 Link *pri; //节点的指数相同,则应该合并两项,即删除后者,并入前者 p2->data->coef += p1->data->coef; pri = PriorPos(*p, p1); DelFirst(pri, &p1); FreeNode(p1); --p->len; if (fabs(p2->data->coef) < 1e-6) { //如果合并后系数为0,那也要把这个节点删除 pri = PriorPos(*p, p2); DelFirst(pri, &p2); FreeNode(p2); --p->len; } p1 = pri; break; } else if (p1->data->expn < p2->data->expn) { Link *pri1, *pri2; pri1 = PriorPos(*p, p1); DelFirst(pri1, &p1); pri2 = PriorPos(*p, p2); InsFirst(pri2, p1); p1 = pri1; break; } } } p->tail = GetLast(*p);}
开发者ID:TianLanhe,项目名称:Data_Structure,代码行数:33,
示例8: AGetIdHashValue/* Get the identity-based hash value for an object reference at *v. This may cause the object to move, thus updating *v. */AValue AGetIdHashValue(AThread *t, AValue *v){ void *p = AValueToPtr(*v); HashMappingTable *table; AValue hash; if (AIsInNursery(p)) table = &NewGenTable; else table = &OldGenTable; ALockHashMappings(); hash = GetHashMapping(table, p); if (AIsError(hash)) { /* Could not find a mapping -- insert a new hash mapping. */ int i; HashValueNode *n; /* Allocate a new hash node. Note that this may cause the object to be moved, but we'll handle that case later. */ n = AllocNode(p); if (n == NULL) { /* Out of memory. */ AUnlockHashMappings(); return ARaiseMemoryErrorND(t); } /* Check if it is time to grow the hash table. This may cause the object to be moved. */ if (table->num > table->size) { if (!GrowHashTable(table)) { /* Out of memory. */ FreeNode(n); AUnlockHashMappings(); return ARaiseMemoryErrorND(t); } } /* If the target value moved to the old generation, try again. */ if (p != AValueToPtr(*v)) { FreeNode(n); AUnlockHashMappings(); return AGetIdHashValue(t, v); } /* Calculate hash value for the internal hash table. */ i = PtrHashValue(p) & (table->size - 1); /* Initialize the new table entry. */ n->next = table->table[i]; table->num++; table->table[i] = n; hash = n->hashValue; } AUnlockHashMappings(); return hash;}
开发者ID:JukkaL,项目名称:alore,代码行数:61,
示例9: FreeNodevoid FreeNode( NODE * n ){ if( n == 0 ) return; FreeNode( n->left ); FreeNode( n->right ); if( n->elm ) free( n->elm ); free( n );}
开发者ID:CEKrause,项目名称:WRFV_3.7.1,代码行数:8,
示例10: FreeNodevoid b2DynamicTree::RemoveLeaf(int32 leaf){ if (leaf == m_root) { m_root = b2_nullNode; return; } int32 parent = m_nodes[leaf].parent; int32 grandParent = m_nodes[parent].parent; int32 sibling; if (m_nodes[parent].child1 == leaf) { sibling = m_nodes[parent].child2; } else { sibling = m_nodes[parent].child1; } if (grandParent != b2_nullNode) { // Destroy parent and connect sibling to grandParent. if (m_nodes[grandParent].child1 == parent) { m_nodes[grandParent].child1 = sibling; } else { m_nodes[grandParent].child2 = sibling; } m_nodes[sibling].parent = grandParent; FreeNode(parent); // Adjust ancestor bounds. int32 index = grandParent; while (index != b2_nullNode) { index = Balance(index); int32 child1 = m_nodes[index].child1; int32 child2 = m_nodes[index].child2; m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height); index = m_nodes[index].parent; } } else { m_root = sibling; m_nodes[sibling].parent = b2_nullNode; FreeNode(parent); } //Validate();}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:58,
示例11: FreeNodevoid b2DynamicTree::RemoveLeaf(int32 leaf){ if (leaf == m_root) { m_root = b2_nullNode; return; } int32 node2 = m_nodes[leaf].parent; int32 node1 = m_nodes[node2].parent; int32 sibling; if (m_nodes[node2].child1 == leaf) { sibling = m_nodes[node2].child2; } else { sibling = m_nodes[node2].child1; } if (node1 != b2_nullNode) { // Destroy node2 and connect node1 to sibling. if (m_nodes[node1].child1 == node2) { m_nodes[node1].child1 = sibling; } else { m_nodes[node1].child2 = sibling; } m_nodes[sibling].parent = node1; FreeNode(node2); // Adjust ancestor bounds. while (node1 != b2_nullNode) { b2AABB oldAABB = m_nodes[node1].aabb; m_nodes[node1].aabb.Combine(m_nodes[m_nodes[node1].child1].aabb, m_nodes[m_nodes[node1].child2].aabb); if (oldAABB.Contains(m_nodes[node1].aabb)) { break; } node1 = m_nodes[node1].parent; } } else { m_root = sibling; m_nodes[sibling].parent = b2_nullNode; FreeNode(node2); }}
开发者ID:006,项目名称:ios_lab,代码行数:55,
示例12: power_tech_xml_load_multiplexer_info/** * Read multiplexer information from the .xml transistor characteristics. * This contains the estimates of mux output voltages, depending on 1) Mux Size 2) Mux Vin * */static void power_tech_xml_load_multiplexer_info(ezxml_t parent) { ezxml_t child, prev, gc; int num_mux_sizes; int i, j; /* Process all multiplexer sizes */ num_mux_sizes = CountChildren(parent, "multiplexer", 1); /* Add entries for 0 and 1, for convenience, although * they will never be used */ g_power_tech->max_mux_sl_size = 1 + num_mux_sizes; g_power_tech->mux_voltage_inf = (t_power_mux_volt_inf*) my_calloc( g_power_tech->max_mux_sl_size + 1, sizeof(t_power_mux_volt_inf)); child = FindFirstElement(parent, "multiplexer", TRUE); i = 1; while (child) { int num_voltages; assert(i == GetFloatProperty(child, "size", TRUE, 0)); /* For each mux size, process all of the Vin levels */ num_voltages = CountChildren(child, "voltages", 1); g_power_tech->mux_voltage_inf[i].num_voltage_pairs = num_voltages; g_power_tech->mux_voltage_inf[i].mux_voltage_pairs = (t_power_mux_volt_pair*) my_calloc(num_voltages, sizeof(t_power_mux_volt_pair)); gc = FindFirstElement(child, "voltages", TRUE); j = 0; while (gc) { /* For each mux size, and Vin level, get the min/max V_out */ g_power_tech->mux_voltage_inf[i].mux_voltage_pairs[j].v_in = GetFloatProperty(gc, "in", TRUE, 0.0); g_power_tech->mux_voltage_inf[i].mux_voltage_pairs[j].v_out_min = GetFloatProperty(gc, "out_min", TRUE, 0.0); g_power_tech->mux_voltage_inf[i].mux_voltage_pairs[j].v_out_max = GetFloatProperty(gc, "out_max", TRUE, 0.0); prev = gc; gc = gc->next; FreeNode(prev); j++; } prev = child; child = child->next; FreeNode(prev); i++; }}
开发者ID:haojunliu,项目名称:OpenFPGA,代码行数:57,
示例13: whilevoid palProfiler::FreeNode(palProfilerNode* node) { if (node->child) { palProfilerNode* sibling_node = node->child->sibling; while (sibling_node != NULL) { palProfilerNode* next = sibling_node->sibling; FreeNode(sibling_node); sibling_node = next; } FreeNode(node->child); } if (node != &root_) { _profile_proxy_allocator->Destruct(node); }}
开发者ID:astrotycoon,项目名称:pal,代码行数:14,
示例14: MkSubstvoid MkSubst( NODE *n1, NODE *n2 ){NODE *n; n = LookUpSubst( n1 ); if( n == 0 ) { n = n1; n->left = substList; substList = n; } else { FreeNode( n->right ); FreeNode( n1 ); } n->right = n2;}
开发者ID:CEKrause,项目名称:WRFV_3.7.1,代码行数:15,
示例15: SubNODE * Sub( NODE *n1, NODE *n2 ){ if( n1 == 0 ) return BinaryOp( SUB, 0, n2 ); if( n2 == 0 ) return n1; if( IsConst( n1, 0 ) ) { FreeNode( n1 ); return BinaryOp( SUB, 0, n2 ); } if( IsConst( n2, 0 ) ) { FreeNode( n2 ); return n1; } return BinaryOp( SUB, n1, n2 ); }
开发者ID:CEKrause,项目名称:WRFV_3.7.1,代码行数:15,
示例16: AddNODE * Add( NODE *n1, NODE *n2 ){ if( n1 == 0 ) return n2; if( n2 == 0 ) return n1; if( IsConst( n1, 0 ) ) { FreeNode( n1 ); return n2; } if( IsConst( n2, 0 ) ) { FreeNode( n2 ); return n1; } return BinaryOp( ADD, n1, n2 ); }
开发者ID:CEKrause,项目名称:WRFV_3.7.1,代码行数:15,
示例17: DeleteTreeNode//删除树节点,到此时的树节点,最多只有一个孩子,而且是左孩子void DeleteTreeNode(TreePtr tree,TreeNodePtr node){ TreeNodePtr brother = NULL; TreeNodePtr child = NULL; TreeNodePtr parent = NULL; parent = node->parent; child = (NULL == node->left) ? node->right : node->left; //child = node->left; //没有父节点和子女节点,是唯一一个节点,case 1 if ((NULL == child) && (NULL == parent)) { SetRootNode(tree,NULL); } else if ((NULL != child) && (NULL == parent)) { //只有一个孩子节点,没有父节点,case 2 SetRootNode(tree,child); } else if ((NULL == child) && (NULL != parent)) { //没有孩子节点,有父节点 if (node == parent->left) { SetLeftChild(parent,NULL);//child = NULL } else { SetRightChild(parent,NULL);//child = NULL } /* if (BlackNode == node->color) { DeleteNodeFix(tree,node); } */ } else { //有孩子节点,有父节点 if (node == parent->left) { SetLeftChild(parent,child);//child = NULL } else { SetRightChild(parent,child);//child = NULL } //N=B但是P=R,C=R时,需要将孩子节点设置为黑色 child->color = BlackNode; if (BlackNode == node->color) { //这个节点已经代替了node的位置 DeleteNodeFix(tree,child); } } FreeNode(tree,node);}
开发者ID:why0603,项目名称:angel,代码行数:61,
示例18: FreeNodevoid H2_3D_Tree::FreeNode(nodeT *A) { int i; // Free all child nodes first for (i=0;i<8;i++) { if (A->leaves[i] != NULL) { FreeNode(A->leaves[i]); } } // Free the arrays for the field and source values if (A->fieldval != NULL) free(A->fieldval), A->fieldval=NULL; if (A->sourceval != NULL) free(A->sourceval), A->sourceval=NULL; if (A->proxysval != NULL) free(A->proxysval), A->proxysval=NULL; if (A->sourcefre != NULL) free(A->sourcefre), A->sourcefre=NULL; // Free the field and source lists if (A->fieldlist != NULL) free(A->fieldlist), A->fieldlist=NULL; if (A->sourcelist != NULL) free(A->sourcelist), A->sourcelist=NULL; // Last free the node free(A);}
开发者ID:amaliak,项目名称:CSKS_Tracer,代码行数:28,
示例19: DeleteNode/** * {{{ 删除列表 */int DeleteNode(Link to_delete){ Link curr, prev; int i; if (Head == NULL) return 0; for (prev = NULL, curr = Head; curr != NULL && (i = NodeCmp(to_delete, curr)) > 0; prev = curr, curr = curr->Next) { // empty loop } if (curr != NULL && i == 0) { if (prev) { prev->Next = curr->Next; } else { Head = curr->Next; } FreeNode(curr); NodeCount -= 1; return 1; } return 0;}
开发者ID:nmred,项目名称:study_test,代码行数:29,
示例20: assertbool CudaAllocBuckets::Free(void* p) { AddressMap::iterator it = _addressMap.find(p); if(it == _addressMap.end()) { // If the pointer was not found in the address map, cudaFree it anyways // but return false. if(p) cudaFree(p); return false; } // Because we're freeing a page, it had better not be in the priority queue. MemList::iterator memIt = it->second; assert(memIt->priority == _priorityMap.end()); // Always free allocations larger than the largest bucket if(NumBuckets == memIt->bucket) FreeNode(memIt); else { it->second->priority = _priorityMap.insert( std::make_pair(_counter++ - memIt->bucket, memIt)); // Freed nodes are moved to the front, committed nodes are moved to the // end. MemList& list = _memLists[memIt->bucket]; list.splice(list.begin(), list, memIt); _committed -= BucketSizes[memIt->bucket]; } Compact(0); return true;}
开发者ID:BillOmg,项目名称:moderngpu,代码行数:29,
示例21: ASSERT_VALIDvoid CPtrList::RemoveAt(POSITION position){ ASSERT_VALID(this); CNode* pOldNode = (CNode*) position; ASSERT(AfxIsValidAddress(pOldNode, sizeof(CNode))); if (pOldNode == NULL) { AfxThrowInvalidArgException(); } // remove pOldNode from list if (pOldNode == m_pNodeHead) { m_pNodeHead = pOldNode->pNext; } else { ASSERT(AfxIsValidAddress(pOldNode->pPrev, sizeof(CNode))); pOldNode->pPrev->pNext = pOldNode->pNext; } if (pOldNode == m_pNodeTail) { m_pNodeTail = pOldNode->pPrev; } else { ASSERT(AfxIsValidAddress(pOldNode->pNext, sizeof(CNode))); pOldNode->pNext->pPrev = pOldNode->pPrev; } FreeNode(pOldNode);}
开发者ID:jbeaurain,项目名称:omaha_vs2010,代码行数:33,
示例22: structure/* This function prints a URL to glycam online carbohydrate builder generating a 3D structure (e.g. PDB) of the specified structure. SYNTAX: print3D <str> */int BU_PrintStruct3DLink(){ struct BU_Struct *str; struct VA_Variable *var; PA_GetString; str=(struct BU_Struct *) FindNode(&(StructList.Head), PA_Result.String); if(!str) { Error(PA_ERR_FAIL,"Structure not found"); } var=(struct VA_Variable *)FindNode(&(VariableList.Head), "Print3D"); if (var==NULL) { var=(struct VA_Variable *)ME_CreateNode(&VariableMethod,&VariableList, "Print3D"); } var->Value.Value.Float=1; var->Value.Type=PA_FLOAT; printf("http://www.glycam.com/CCRC/carbohydrates/cb_cnpSequences.jsp?projectName=casper&text1="); GFX_StructGfx(str, NULL, 0); FreeNode((struct Node *)var); return (PA_ERR_OK);}
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:32,
示例23: whilevoid CudaAllocBuckets::Compact(size_t extra) { while(_allocated + extra > _capacity && _allocated > _committed) { // Walk the priority queue from beginning to end removing nodes. MemList::iterator memIt = _priorityMap.begin()->second; FreeNode(memIt); }}
开发者ID:BillOmg,项目名称:moderngpu,代码行数:7,
示例24: mainmain(){ DList *plist = NULL; PNode p = NULL; plist = InitList(); p = InsFirst(plist,MakeNode(1)); InsBefore(plist,p,MakeNode(2)); InsAfter(plist,p,MakeNode(3)); printf("p前驱位置的值为%d/n",GetItem(GetPrevious(p))); printf("p位置的值为%d/n",GetItem(p)); printf("p后继位置的值为%d/n",GetItem(GetNext(p))); printf("遍历输出各节点数据项:/n"); ListTraverse(plist,print); printf("除了头节点该链表共有%d个节点/n",GetSize(plist)); FreeNode(DelFirst(plist)); printf("删除第一个节点后重新遍历输出为:/n"); ListTraverse(plist,print); printf("除了头节点该链表共有%d个节点/n",GetSize(plist)); DestroyList(plist); printf("链表已被销毁/n");}
开发者ID:wugsh,项目名称:wgs,代码行数:25,
示例25: power_tech_xml_load_nmos_st_leakages/** * Read NMOS subthreshold leakage currents from the .xml transistor characteristics * This builds a table of (Vds,Ids) value pairs * */static void power_tech_xml_load_nmos_st_leakages(ezxml_t parent) { ezxml_t child, prev; int num_leakage_pairs; int i; num_leakage_pairs = CountChildren(parent, "nmos_leakage", 1); g_power_tech->num_leakage_pairs = num_leakage_pairs; g_power_tech->leakage_pairs = (t_power_nmos_leakage_pair*) my_calloc( num_leakage_pairs, sizeof(t_power_nmos_leakage_pair)); child = FindFirstElement(parent, "nmos_leakage", TRUE); i = 0; while (child) { g_power_tech->leakage_pairs[i].v_ds = GetFloatProperty(child, "Vds", TRUE, 0.0); g_power_tech->leakage_pairs[i].i_ds = GetFloatProperty(child, "Ids", TRUE, 0.0); prev = child; child = child->next; FreeNode(prev); i++; }}
开发者ID:haojunliu,项目名称:OpenFPGA,代码行数:29,
示例26: DestroyList Status DestroyList(LinkList *L) { /* 销毁线性链表L,L不再存在 */ ClearList(L); /* 清空链表 */ FreeNode(&(*L).head); (*L).tail=NULL; (*L).len=0; return OK; }
开发者ID:beike2020,项目名称:source,代码行数:8,
示例27: b2Assertvoid b2DynamicTree::DestroyProxy(int32 proxyId){ b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); b2Assert(m_nodes[proxyId].IsLeaf()); RemoveLeaf(proxyId); FreeNode(proxyId);}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:8,
示例28: DestroyList static Status DestroyList(LinkList &L) { // 销毁线性链表L,L不再存在 ClearList(L); // 清空链表 FreeNode(L.head); L.tail=NULL; L.len=0; return OK; }
开发者ID:cjpthree,项目名称:datastructure_vs,代码行数:8,
示例29: FreeHashvoid FreeHash(HashList* list, int tableSize){ int i; for (i = 0; i < tableSize; i++) { FreeNode(list[i]); }}
开发者ID:LooJee,项目名称:LeetCode,代码行数:8,
注:本文中的FreeNode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FreePool函数代码示例 C++ FreeMediaType函数代码示例 |