当前位置: 首页>>代码示例>>C++>>正文


C++ freeNode函数代码示例

本文整理汇总了C++中freeNode函数的典型用法代码示例。如果您正苦于以下问题:C++ freeNode函数的具体用法?C++ freeNode怎么用?C++ freeNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了freeNode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: freeNode

void freeNode(NODE *node) {
   
   // release Name-Values (attribs)
   nameValue *nextNV = NULL;
   while (node->nV) {
      nextNV = node->nV->next;
      if (node->nV->bFreeValuePtr) {
         free(node->nV->value.s);
      }
      free(node->nV);
      node->nV = nextNV;
   }
   
   // release child
   if (node->child) {
      freeNode(node->child);
   }
   
   // release brother
   if (node->next) {
      freeNode(node->next);
   }
   
   free(node);
}
开发者ID:ioerror,项目名称:silent-phone-base,代码行数:25,代码来源:parse_xml.cpp

示例2: deleteLast

void deleteLast(ListRef L) {
    NodeRef n;
    
    if (L == NULL) {
        printf( "Error: Called deleteLast() on NULL ListRef\n");
        //exit(EXIT_FAILURE);
    } else if (isEmpty(L)) {
        printf( "Error: Called deleteLast() on empty ListRef\n");
        //exit(EXIT_FAILURE);
    }
    if ( L->first == L->current ) {
        L->current = NULL;
    }
    if (L->length == 1) {
        freeNode(&(L->last));
        L->last = NULL;
        L->first = NULL;
    } else {
        n = L->last;
        L->last = n->prev;
        n->prev->next = NULL;
        n->prev = NULL;
        freeNode(&n);
        n = NULL;
    }
    L->length--;
}
开发者ID:ishvartser,项目名称:slug,代码行数:27,代码来源:list.c

示例3: deleteNodeAt

void deleteNodeAt(int i)
{
    if (i == 0) {
        // Removing head
        Node *tmp = head;
        head = head->next;
        
        tmp->next = NULL;
        freeNode(tmp);
    } else {
        int j = 0;
        Node *node = head;
        Node *prev = NULL;
        while (j < i) {
            prev = node;
            node = node->next;
            j++;
        }
                
        prev->next = node->next;
        node->next = NULL;
        freeNode(node);
    }
    
    size--;
}
开发者ID:mtotheikle,项目名称:cscd340-hw3,代码行数:26,代码来源:linkedList.c

示例4: freeList

/**
 * This method is the deconstructor for the List class
 */
void freeList(ListPtr list) {
	if (list == NULL ) {
		return;
	}
	if (list->size == 0) {
		free(list);
		return;
	}
	if (list->size == 1 && list->head != NULL ) {
		freeNode(list->head, list->freeObject);
		free(list);
		return;
	}
	if (list->size < 0 || (list->head != NULL && list->head->data == NULL) || (list->tail!= NULL && list->tail->data == NULL))
		return;

	NodePtr temp = list->head;

	while (temp->next != NULL ) {
		NodePtr tempPrev = temp;
		temp = temp->next;
		freeNode(tempPrev, list->freeObject);
	}
	freeNode(temp, list->freeObject);
	free(list);
	return;
}
开发者ID:chilininsd,项目名称:operating_systems,代码行数:30,代码来源:List.c

示例5: assignNode

bTreeNode bTree::findBro(bTreeNode& node){
    bTreeNode par = assignNode(node.parentPtr);
    if(findPath.back() > 0 && findPath.back() < par.valNum)
    {
        bTreeNode l = assignNode(par.ptrList[findPath.back()-1]);
        bTreeNode r = assignNode(par.ptrList[findPath.back()+1]);
        freeNode(par);
        if(l.valNum<r.valNum)
        {
            freeNode(r);
            return l;
        }
        else
        {
            freeNode(l);
            return r;
        }
    }
    freeNode(par);
    if(findPath.back() > 0)
        return assignNode(par.ptrList[findPath.back()-1]);
    if(findPath.back() < par.valNum)
        return assignNode(par.ptrList[findPath.back()+1]);
    return bTreeNode();
}
开发者ID:EverNine,项目名称:MiniSQL_indexManager,代码行数:25,代码来源:bTree.cpp

示例6: taskwdAnyRemove

void taskwdAnyRemove(void *key)
{
    struct mNode *pm;
    struct aNode *pa;

    taskwdInit();

    epicsMutexMustLock(mLock);
    pm = (struct mNode *)ellFirst(&mList);
    while (pm) {
        if (pm->funcs == &anyFuncs) {
            pa = (struct aNode *)pm->usr;
            if (pa->key == key) {
                ellDelete(&mList, (void *)pm);
                freeNode((union twdNode *)pa);
                freeNode((union twdNode *)pm);
                epicsMutexUnlock(mLock);
                return;
            }
        }
        pm = (struct mNode *)ellNext(&pm->node);
    }
    epicsMutexUnlock(mLock);

    errlogPrintf("taskwdAnyRemove: Unregistered key %p\n", key);
}
开发者ID:ukaea,项目名称:epics,代码行数:26,代码来源:taskwd.c

示例7: convertAttributesToText

Node convertAttributesToText (Node node)
{
    char* str;
    int len, at, i;
    Node ret = 0, examine = node->firstChild, prevExamine;
    AttributeData ad;

    if (node->type != AttributeGroup) return 0;

    /* We've stored the first child in examine, so we can already free the parent */
    freeNode (node);

    while (examine) /* should be an Attribute node */
    {
        ad = examine->data.attrdata;
        /* first turn attribute name, equals sign (if any) and
         * opening apostrophe or quotes (if any) into one string */
        len = strlen (ad->name);
        at = len;
        len += ad->spacesAfterName;
        if (ad->type > 0)
        {
            len++; /* '=' */
            len += ad->spacesAfterEquals;
            if (ad->type > 1) len++;  /* ' or " */
        }
        len++; /* trailing '\0' */

        str = (char*) malloc (len * sizeof (char));
        memcpy (str, ad->name, at * sizeof (char));
        while (ad->spacesAfterName--) str[at++] = ' ';
        if (ad->type > 0)
        {
            str[at++] = '=';
            while (ad->spacesAfterEquals--) str[at++] = ' ';
            if (ad->type == 2) str[at++] = '\'';
            else if (ad->type == 3) str[at++] = '"';
        }
        str[at] = '\0';

        ret = makeTextBlock2 (ret, newNodeS (TextToken, str), examine->firstChild);

        if (ad->type > 1 || (ad->type == 1 && ad->spacesAfterValue > 0))
        {
            at = ad->type > 1 ? 1 : 0;
            len = at + ad->spacesAfterValue;
            str = (char*) malloc (len * sizeof (char));
            if (ad->type == 2) str[0] = '\'';
            else if (ad->type == 3) str[0] = '"';
            while (ad->spacesAfterValue--) str[at++] = ' ';
            str[at] = '\0';
            ret = makeTextBlock (ret, newNodeS (TextToken, str));
        }
        prevExamine = examine;
        examine = examine->nextSibling;
        freeNode (prevExamine);
    }

    return ret;
}
开发者ID:BackupTheBerlios,项目名称:wiki4freetz-svn,代码行数:60,代码来源:parsetree.c

示例8: recDelete

int recDelete(rect *r, node *n, int pos){
    int i,j;
    node *n1, *n2;
    if(n->leaf){
    	for(i = 0; i < n->size; ++i)
    		if(n->values[i]->child == pos){
            	deleteValue(n, i);
            	writeNode(n);
    			return TRUE;
    		}
    	return FALSE;
    }

    for(i = 0; i < n->size; ++i)
        if(intersect(r, n->values[i]->r)){
            n1 = readNode(n->values[i]->child);

            if(recDelete(r, n1, pos)){
            	n->values[i]->r = dupRect(n1->MBR);
                if(n1->size < b )
                	underflow(n, n1, i);
                else{
                	refreshMBR(n);
                	writeNode(n);
    				freeNode(n1);
                }
                return TRUE;
            }
            else
                freeNode(n1);

        }
    return FALSE;

}
开发者ID:javierab,项目名称:T1Alg,代码行数:35,代码来源:RTree.c

示例9: removeFromList

void removeFromList(Node** head, int offset) {
    //int location = findOffset(head, offset);
    printf("\n removing from list ");
    Node* p = *head;
    int i =0;
    if((*head)->data->offset == offset)
    {
        *head = (*head)->next;
        freeNode(p);
        return;
    }
    while(p->next!=NULL) {
        if(p->next->data->offset == offset)
            break;
        p = p->next;
    }

    printf("\n printing value of prev node%d", p->data->offset);

    Node* q = p->next;
    if(p->next!=NULL)
        p->next = p->next->next;
    freeNode(q);
    printf("\n removed node");
}
开发者ID:harshithatlb,项目名称:programming_practice,代码行数:25,代码来源:buffAggr.c

示例10: findFirstNode

std::vector<unsigned int> bTree::findGreater(Index ind, bool equal){
    unsigned int i;
    std::vector<unsigned int> res;
    bTreeNode cur = findFirstNode(ind);

    for (i = 0; i < cur.valNum; ++i)
    {
       if(cur.indexList[i]>=ind) 
           break;
    }
    if(i>=cur.valNum)
    {
        freeNode(cur);
        if(cur.ptrList.back()==0)
            return res;
        cur = assignNode(cur.ptrList.back());
        i = 0;
    }
    while(true)
    {
        if(equal || cur.indexList[i]!=ind)
            res.push_back(cur.ptrList[i]);
        i++;
        if(i>=cur.valNum)
        {
            if(cur.ptrList[i]==0)
                break;
            freeNode(cur);
            cur = assignNode(cur.ptrList[i]);
            i = 0;
        }
    }
    freeNode(cur);
    return res;
}
开发者ID:EverNine,项目名称:MiniSQL_indexManager,代码行数:35,代码来源:bTree.cpp

示例11: freeList

void freeList(ListPtr L) {
	NodePtr tempNode, currentNode;
	if (L==NULL){
		return;
	}

	if (L->head == NULL ) {
		free(L);
		return;
	}

	if (L->head == L->tail) {
		freeNode(L->head, (void *) L->freeObject);
		free(L);
		return;
	}

	currentNode = L->head;
	while (currentNode != NULL ) {
		tempNode = currentNode;
		currentNode = currentNode->next;

		freeNode(tempNode, (void *) L->freeObject);
	}

	free(L);
}
开发者ID:kgross99,项目名称:count,代码行数:27,代码来源:List.c

示例12: freeNode

/* Recursively deallocate the memory assigned to this node's subtree */
void freeNode(priorityQueueEntry* node)
{
	if(node->childl)
		freeNode(node->childl);
	if(node->childr)
		freeNode(node->childr);
	free(node);	
}
开发者ID:pscha,项目名称:bin_heap,代码行数:9,代码来源:PriorityQueue.c

示例13: freeNode

void freeNode( Node *node )
{
    if (node != NULL) {
        freeNode( node->left );
        freeNode( node->right );
    }
    free( node );
}
开发者ID:xquiet,项目名称:sdlbasic,代码行数:8,代码来源:node.c

示例14: freeNode

/* freeNode: free node created with node() */
void freeNode(struct node *node)
{
	if (node == NULL)
		return;

	freeNode(node->child);
	freeNode(node->next);
}
开发者ID:tcharding,项目名称:self_learning,代码行数:9,代码来源:node.c

示例15: freeNode

/*!
    \internal
*/
void QGeneralAreaAllocator::freeNode(Node *node)
{
    if (node) {
        freeNode(node->left);
        freeNode(node->right);
    }
    delete node;
}
开发者ID:RS102839,项目名称:qt,代码行数:11,代码来源:qareaallocator.cpp


注:本文中的freeNode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。