tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / exec / addhead.c
blob7ca2d62c0fa501014d817029c2821af26eb8c2c8
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a node to the head 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, AddHead,
18 /* SYNOPSIS */
19 AROS_LHA(struct List *, list, A0),
20 AROS_LHA(struct Node *, node, A1),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 40, Exec)
25 /* FUNCTION
26 Insert Node node as the first node of the list.
28 INPUTS
29 list - The list to insert the node into
30 node - This node is to be inserted
32 RESULT
33 None.
35 NOTES
37 EXAMPLE
38 struct List * list;
39 struct Node * pred;
41 // Insert Node at top
42 AddHead (list, node);
44 BUGS
46 SEE ALSO
47 libamiga/NewList(), AddTail(), Insert(), Remove(), RemHead(), RemTail(),
48 Enqueue()
50 INTERNALS
52 ******************************************************************************/
54 AROS_LIBFUNC_INIT
55 ASSERT_VALID_PTR(node);
56 ASSERT_VALID_PTR(list);
59 Make the node point to the old first node in the list and to the
60 head of the list.
62 node->ln_Succ = list->lh_Head;
63 node->ln_Pred = (struct Node *)&list->lh_Head;
66 New we come before the old first node which must now point to us
67 and the same applies to the pointer to-the-first-node in the
68 head of the list.
70 list->lh_Head->ln_Pred = node;
71 list->lh_Head = node;
72 AROS_LIBFUNC_EXIT
73 } /* AddHead */