Add ellPop() function, removes and returns the last node on a list.
This commit is contained in:
committed by
Michael Davidsaver
parent
06bcdb0ade
commit
9a02181084
@@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* $Revision-Id$
|
||||
*
|
||||
@@ -155,6 +155,21 @@ ELLNODE * ellGet (ELLLIST *pList)
|
||||
|
||||
return pnode;
|
||||
}
|
||||
/****************************************************************************
|
||||
*
|
||||
* This function returns the last node in the specified list. The node is
|
||||
* removed from the list. If the list is empty, NULL will be returned.
|
||||
*
|
||||
*****************************************************************************/
|
||||
ELLNODE * ellPop (ELLLIST *pList)
|
||||
{
|
||||
ELLNODE *pnode = pList->node.previous;
|
||||
|
||||
if (pnode != NULL)
|
||||
ellDelete(pList, pnode);
|
||||
|
||||
return pnode;
|
||||
}
|
||||
/****************************************************************************
|
||||
*
|
||||
* This function inserts the specified node pNode after pPrev in the list
|
||||
@@ -185,7 +200,7 @@ void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode)
|
||||
}
|
||||
/****************************************************************************
|
||||
*
|
||||
* This function returns the nodeNum'th element in pList. If there is no
|
||||
* This function returns the nodeNum'th element in pList. If there is no
|
||||
* nodeNum'th node in the list, NULL will be returned.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* $Revision-Id$
|
||||
*
|
||||
@@ -52,6 +52,7 @@ epicsShareFunc void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList);
|
||||
epicsShareFunc void ellDelete (ELLLIST *pList, ELLNODE *pNode);
|
||||
epicsShareFunc void ellExtract (ELLLIST *pSrcList, ELLNODE *pStartNode, ELLNODE *pEndNode, ELLLIST *pDstList);
|
||||
epicsShareFunc ELLNODE * ellGet (ELLLIST *pList);
|
||||
epicsShareFunc ELLNODE * ellPop (ELLLIST *pList);
|
||||
epicsShareFunc void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode);
|
||||
epicsShareFunc ELLNODE * ellNth (ELLLIST *pList, int nodeNum);
|
||||
epicsShareFunc ELLNODE * ellNStep (ELLNODE *pNode, int nStep);
|
||||
|
||||
Reference in New Issue
Block a user