home *** CD-ROM | disk | FTP | other *** search
- /*************************/
- /* */
- /* 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;
- }
- }
- }
-