2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 Desc: Add a node to the head of a list
8 #include <aros/debug.h>
9 #include <exec/lists.h>
10 #include <proto/exec.h>
12 /*****************************************************************************
16 AROS_LH2I(void, AddHead
,
19 AROS_LHA(struct List
*, list
, A0
),
20 AROS_LHA(struct Node
*, node
, A1
),
23 struct ExecBase
*, SysBase
, 40, Exec
)
26 Insert Node node as the first node of the list.
29 list - The list to insert the node into
30 node - This node is to be inserted
47 libamiga/NewList(), AddTail(), Insert(), Remove(), RemHead(), RemTail(),
52 ******************************************************************************/
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
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
70 list
->lh_Head
->ln_Pred
= node
;