Include <X11/Xlib.h> even if USE_VIDMODE is
[tangerine.git] / rom / exec / addtail.c
blob91d821470baba137562e48f171a80703e1b57de0
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a node at the end of a list.
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <exec/lists.h>
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
16 AROS_LH2I(void, AddTail,
18 /* SYNOPSIS */
19 AROS_LHA(struct List *, list, A0),
20 AROS_LHA(struct Node *, node, A1),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 41, Exec)
25 /* FUNCTION
26 Insert Node node at the end of a list.
28 INPUTS
29 list - The list to insert the node into
30 node - This node is to be inserted
32 RESULT
34 NOTES
36 EXAMPLE
37 struct List * list;
38 struct Node * pred;
40 // Insert Node at end of the list
41 AddTail (list, node);
43 BUGS
45 SEE ALSO
47 INTERNALS
49 ******************************************************************************/
51 AROS_LIBFUNC_INIT
52 AROS_GET_SYSBASE
53 // ASSERT_VALID_PTR(node); argh! TypeOfMem() doesn't know about the data segment!
54 ASSERT_VALID_PTR(list);
57 Make the node point to the head of the list. Our predecessor is the
58 previous last node of the list.
60 node->ln_Succ = (struct Node *)&list->lh_Tail;
61 node->ln_Pred = list->lh_TailPred;
64 Now we are the last now. Make the old last node point to us
65 and the pointer to the last node, too.
67 list->lh_TailPred->ln_Succ = node;
68 list->lh_TailPred = node;
69 AROS_LIBFUNC_EXIT
70 } /* AddTail */