xref: /csrg-svn/usr.bin/make/lst.lib/lstInit.c (revision 40411)
1 /*-
2  * init.c --
3  *	Initialize a new linked list.
4  *
5  * Copyright (c) 1988 by University of California Regents
6  *
7  * Permission to use, copy, modify, and distribute this
8  * software and its documentation for any purpose and without
9  * fee is hereby granted, provided that the above copyright
10  * notice appears in all copies.  Neither the University of California nor
11  * Adam de Boor makes any representations about the suitability of this
12  * software for any purpose.  It is provided "as is" without
13  * express or implied warranty.
14  */
15 #ifndef lint
16 static char *rcsid =
17 "$Id: lstInit.c,v 1.7 88/11/17 20:52:57 adam Exp $ SPRITE (Berkeley)";
18 #endif lint
19 
20 #include	"lstInt.h"
21 
22 /*-
23  *-----------------------------------------------------------------------
24  * Lst_Init --
25  *	Create and initialize a new list.
26  *
27  * Results:
28  *	The created list.
29  *
30  * Side Effects:
31  *	A list is created, what else?
32  *
33  *-----------------------------------------------------------------------
34  */
35 Lst
36 Lst_Init(circ)
37     Boolean		circ;	/* TRUE if the list should be made circular */
38 {
39     register List	nList;
40 
41     PAlloc (nList, List);
42 
43     nList->firstPtr = NilListNode;
44     nList->lastPtr = NilListNode;
45     nList->isOpen = FALSE;
46     nList->isCirc = circ;
47     nList->atEnd = Unknown;
48 
49     return ((Lst)nList);
50 }
51 
52 Malloc(nbytes)
53 {
54 #ifdef DEBUG
55     printf("malloc: %d\n", nbytes);
56 #endif DEBUG
57     return(malloc(nbytes));
58 }
59