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