Make ellFree() a 1-argument macro, calls ellFree2() with free as freeFunc.
This commit is contained in:
@@ -613,7 +613,7 @@ static void dbBkptCont(dbCommon *precord)
|
||||
--lset_stack_count;
|
||||
|
||||
/* free entrypoint queue */
|
||||
ellFree(&pnode->ep_queue, free);
|
||||
ellFree(&pnode->ep_queue);
|
||||
|
||||
/* remove execution semaphore */
|
||||
epicsEventDestroy(pnode->ex_sem);
|
||||
|
||||
@@ -263,11 +263,10 @@ int ellFind (ELLLIST *pList, ELLNODE *pNode)
|
||||
*
|
||||
* NOTE: the nodes in the list are free()'d on the assumption that the node
|
||||
* structures were malloc()'d one-at-a-time and that the ELLNODE structure is
|
||||
* the first thing in the "rest of" the node structure.
|
||||
* In other words, this is a pretty worthless function.
|
||||
* the first member of the parent structure.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void ellFree (ELLLIST *pList, FREEFUNC freeFunc)
|
||||
void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc)
|
||||
{
|
||||
ELLNODE *nnode = pList->node.next;
|
||||
ELLNODE *pnode;
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef void (*FREEFUNC)(void *);
|
||||
#define ellLast(PLIST) ((PLIST)->node.previous)
|
||||
#define ellNext(PNODE) ((PNODE)->next)
|
||||
#define ellPrevious(PNODE) ((PNODE)->previous)
|
||||
#define ellFree(PLIST) ellFree2(PLIST, free)
|
||||
|
||||
epicsShareFunc void ellAdd (ELLLIST *pList, ELLNODE *pNode);
|
||||
epicsShareFunc void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList);
|
||||
@@ -55,8 +56,7 @@ epicsShareFunc void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode);
|
||||
epicsShareFunc ELLNODE * ellNth (ELLLIST *pList, int nodeNum);
|
||||
epicsShareFunc ELLNODE * ellNStep (ELLNODE *pNode, int nStep);
|
||||
epicsShareFunc int ellFind (ELLLIST *pList, ELLNODE *pNode);
|
||||
/* ellFree has to take a free function to work properly on Windows */
|
||||
epicsShareFunc void ellFree (ELLLIST *pList, FREEFUNC freeFunc);
|
||||
epicsShareFunc void ellFree2 (ELLLIST *pList, FREEFUNC freeFunc);
|
||||
epicsShareFunc void ellVerify (ELLLIST *pList);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*epicsExit.c*/
|
||||
@@ -52,7 +51,7 @@ static epicsThreadPrivateId exitPvtPerThread = 0;
|
||||
|
||||
static void destroyExitPvt ( exitPvt * pep )
|
||||
{
|
||||
ellFree ( &pep->list, free );
|
||||
ellFree ( &pep->list );
|
||||
free ( pep );
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ MAIN(epicsEllTest)
|
||||
testOk1(ellFind(&list2, ellNth(&list2, 10)) == 10);
|
||||
testOk1(ellFind(&list1, ellNth(&list1, 11)) == 11);
|
||||
|
||||
ellFree(&list2, free);
|
||||
ellFree(&list2);
|
||||
testOk1(ellCount(&list2) == 0);
|
||||
|
||||
pick = (struct myItem *)ellFirst(&list1);
|
||||
@@ -190,7 +190,7 @@ MAIN(epicsEllTest)
|
||||
pitem = (struct myItem *)ellNStep(&pitem->node, -4);
|
||||
testOk1(pitem->num == 7);
|
||||
|
||||
ellFree(&list1, free);
|
||||
ellFree2(&list1, free);
|
||||
testOk1(ellCount(&list1) == 0);
|
||||
|
||||
return testDone();
|
||||
|
||||
Reference in New Issue
Block a user