xref: /csrg-svn/usr.bin/make/lst.lib/lstInit.c (revision 42741)
140412Sbostic /*
240412Sbostic  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
340412Sbostic  * All rights reserved.
440411Sbostic  *
540412Sbostic  * This code is derived from software contributed to Berkeley by
640412Sbostic  * Adam de Boor.
740411Sbostic  *
8*42741Sbostic  * %sccs.include.redist.c%
940411Sbostic  */
1040412Sbostic 
1140411Sbostic #ifndef lint
12*42741Sbostic static char sccsid[] = "@(#)lstInit.c	5.3 (Berkeley) 06/01/90";
1340412Sbostic #endif /* not lint */
1440411Sbostic 
1540412Sbostic /*-
1640412Sbostic  * init.c --
1740412Sbostic  *	Initialize a new linked list.
1840412Sbostic  */
1940412Sbostic 
2040411Sbostic #include	"lstInt.h"
2140411Sbostic 
2240411Sbostic /*-
2340411Sbostic  *-----------------------------------------------------------------------
2440411Sbostic  * Lst_Init --
2540411Sbostic  *	Create and initialize a new list.
2640411Sbostic  *
2740411Sbostic  * Results:
2840411Sbostic  *	The created list.
2940411Sbostic  *
3040411Sbostic  * Side Effects:
3140411Sbostic  *	A list is created, what else?
3240411Sbostic  *
3340411Sbostic  *-----------------------------------------------------------------------
3440411Sbostic  */
3540411Sbostic Lst
3640411Sbostic Lst_Init(circ)
3740411Sbostic     Boolean		circ;	/* TRUE if the list should be made circular */
3840411Sbostic {
3940411Sbostic     register List	nList;
4040411Sbostic 
4140411Sbostic     PAlloc (nList, List);
4240411Sbostic 
4340411Sbostic     nList->firstPtr = NilListNode;
4440411Sbostic     nList->lastPtr = NilListNode;
4540411Sbostic     nList->isOpen = FALSE;
4640411Sbostic     nList->isCirc = circ;
4740411Sbostic     nList->atEnd = Unknown;
4840411Sbostic 
4940411Sbostic     return ((Lst)nList);
5040411Sbostic }
5140411Sbostic 
5240411Sbostic Malloc(nbytes)
5340411Sbostic {
5440411Sbostic #ifdef DEBUG
5540411Sbostic     printf("malloc: %d\n", nbytes);
5640411Sbostic #endif DEBUG
5740411Sbostic     return(malloc(nbytes));
5840411Sbostic }
59