1 /* MetaMake - A Make extension
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
4 This file is part of MetaMake.
6 MetaMake is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 MetaMake is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* This file contains the code for the list functions */
39 AssignList (struct List
* dest
, struct List
* src
)
43 if (src
->first
->next
!= NULL
)
45 src
->first
->prev
= (struct Node
*)&dest
->first
;
46 dest
->first
= src
->first
;
47 src
->prelast
->next
= (struct Node
*)&dest
->last
;
48 dest
->prelast
= src
->prelast
;
53 FindNode (const struct List
* l
, const char * name
)
59 if (!strcmp (n
->name
, name
))
67 printlist (struct List
* l
)
73 printf (" \"%s\"\n", n
->name
);
78 freelist (struct List
* l
)
80 struct Node
* node
, * next
;
82 ForeachNodeSafe(l
,node
,next
)
92 newnode (const char * name
)
98 n
= new (struct Node
);
100 n
->name
= xstrdup (name
);
106 newnodesize (const char * name
, size_t size
)
112 n
= (struct Node
*)xmalloc (size
);
115 n
->name
= xstrdup (name
);
121 addnodeonce (struct List
* l
, const char * name
)
125 n
= FindNode (l
, name
);
137 addnodeoncesize (struct List
* l
, const char * name
, size_t size
)
141 n
= FindNode (l
, name
);
145 n
= newnodesize (name
, size
);