1 /* 2 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Adam de Boor. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11 #ifndef lint 12 static char sccsid[] = "@(#)lstInit.c 5.3 (Berkeley) 06/01/90"; 13 #endif /* not lint */ 14 15 /*- 16 * init.c -- 17 * Initialize a new linked list. 18 */ 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