home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 74
/
af074a.adf
/
archives
/
af74a3.lzx
/
Typeface
/
Source
/
node.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-08
|
731b
|
45 lines
/*************************/
/* */
/* Node and list handing */
/* */
/*************************/
#include "Typeface.h"
struct List *GetNewList(struct List **list)
{
if (*list = AllocVec(sizeof(struct List),MEMF_CLEAR))
{
NewList(*list);
return(*list);
}
else return(NULL);
}
struct Node *CreateNode(ULONG size,struct List *list)
{
struct Node *node = NULL;
if (node = AllocVec(size,MEMF_CLEAR)) AddTail(list,node);
return(node);
}
void RemoveList(struct List **list,BOOL all,(*hook)())
{
struct Node *node;
if (*list != NULL)
{
while (node = RemHead(*list))
{
if (hook) hook(node);
FreeVec(node);
}
if (all)
{
FreeVec(*list);
*list = NULL;
}
}
}