Corrected invalid characters.
[tangerine.git] / rom / exec / remtail.c
blob94cc065978d3d6663be7a2aedf877fa787ac4ca3
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Remove the last node of a list
6 Lang: english
7 */
9 #include <aros/debug.h>
11 /*****************************************************************************
13 NAME */
14 #include <exec/lists.h>
15 #include <proto/exec.h>
17 AROS_LH1I(struct Node *, RemTail,
19 /* SYNOPSIS */
20 AROS_LHA(struct List *, list, A0),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 44, Exec)
25 /* FUNCTION
26 Remove the last node from a list.
28 INPUTS
29 list - Remove the node from this list
31 RESULT
32 The node that has been removed.
34 NOTES
36 EXAMPLE
37 struct List * list;
38 struct Node * tail;
40 // Remove node and return it
41 tail = RemTail (list);
43 BUGS
45 SEE ALSO
47 INTERNALS
49 ******************************************************************************/
51 AROS_LIBFUNC_INIT
52 struct Node * node;
55 Unfortunately, there is no (quick) check that the node
56 is in a list.
58 ASSERT(list != NULL);
60 /* Get the last node of the list */
61 if ( (node = GetTail (list)) )
63 /* normal code to remove a node if there is one */
64 node->ln_Pred->ln_Succ = node->ln_Succ;
65 node->ln_Succ->ln_Pred = node->ln_Pred;
68 /* return it's address or NULL if there was no node */
69 return node;
70 AROS_LIBFUNC_EXIT
71 } /* RemTail */