/*
 * Copyright 1990 by Baylor College of Medicine ALL RIGHTS RESERVED. 
 *
 * This program is subject to a license agreement between 
 * Baylor College of Medicine and MIT. Any use inconsistent with
 * said license and any use by persons other than the faculty, 
 * students and staff at MIT or any use on a computer not operated 
 * as part of the Athena Computing Environment (ACE) is expressly 
 * prohibited.
 */
#include <stdio.h>
#include <util.h>
#include <malloc.h>

ll_init(ll)
	LongLinkedList *ll ;
{
	ll->n = 0 ;
	ll->first = NULL ;
	ll->last = &(ll->first) ;
}

ll_add(ll,l)
	LongLinkedList *ll ;
	long l ;
{
	LongLinkNode new = (LongLinkNode)malloc(sizeof *new) ;
	new->l = l ;
	new->next = NULL ;
	*(ll->last) = new ;
	ll->last = &(new->next) ;
	ll->n++ ;
}

ll_free(ll)
	LongLinkedList *ll ;
{
	while(ll->n && ll->first != NULL)
	{
		LongLinkNode nxt = ll->first ;
		free((char *)ll->first) ;
		ll->first = nxt ;
		ll->n-- ;
	}
	ll->last = &(ll->first) ;
}
