Minor fixes to comments.
[AROS.git] / rom / exec / remhead.c
blob4f6ca3230e11f6b5a0e2b9a2d03f2144f6001405
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Remove the first 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 *, RemHead,
19 /* SYNOPSIS */
20 AROS_LHA(struct List *, list, A0),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 43, Exec)
25 /* FUNCTION
26 Remove the first 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 * head;
40 // Remove node and return it
41 head = RemHead (list);
43 BUGS
45 SEE ALSO
47 INTERNALS
49 ******************************************************************************/
51 AROS_LIBFUNC_INIT
52 struct Node * node;
54 ASSERT(list != NULL);
56 Unfortunately, there is no (quick) check that the node
57 is in a list
60 /* Get the address of the first node or NULL */
61 node = list->lh_Head->ln_Succ;
62 if (node)
64 node->ln_Pred = (struct Node *)list;
65 node = list->lh_Head;
66 list->lh_Head = node->ln_Succ;
69 /* Return the address or NULL */
70 return node;
71 AROS_LIBFUNC_EXIT
72 } /* RemHead */