140865Sbostic /*-
2*62092Sbostic  * Copyright (c) 1982, 1993
3*62092Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
710224Smckusick 
840865Sbostic #ifndef lint
9*62092Sbostic static char sccsid[] = "@(#)DFDISPOSE.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
1110224Smckusick 
1210224Smckusick /*
1310224Smckusick  * Close all active files within a dynamic record,
1410224Smckusick  * then dispose of the record.
1510224Smckusick  */
1610224Smckusick 
1710224Smckusick #include "h00vars.h"
1810224Smckusick #include "libpc.h"
1910224Smckusick 
DFDISPOSE(var,size)2010224Smckusick DFDISPOSE(var, size)
2110224Smckusick 	char	**var;	/* pointer to pointer being deallocated */
2210224Smckusick 	long	size;	/* sizeof(bletch) */
2310224Smckusick {
2410224Smckusick 	register struct iorec	*next, *prev;
2510224Smckusick 	struct iorec *start, *end;
2610224Smckusick 
2710224Smckusick 	start = (struct iorec *)(*var);
2810224Smckusick 	end = (struct iorec *)(*var + size);
2910224Smckusick 	prev = (struct iorec *)(&_fchain);
3010224Smckusick 	next = _fchain.fchain;
3110224Smckusick 	while(next != FILNIL && (next->flev < GLVL || next < start)) {
3210224Smckusick 		prev = next;
3310224Smckusick 		next = next->fchain;
3410224Smckusick 	}
3529547Smckusick 	while(next != FILNIL && start <= next && next < end)
3610565Smckusick 		next = PFCLOSE(next, TRUE);
3710224Smckusick 	prev->fchain = next;
3810224Smckusick 	DISPOSE(var, size);
3910224Smckusick }
40