1 /* Copyright (c) 1982 Regents of the University of California */
2 
3 static	char sccsid[] = "@(#)DFDISPOSE.c	4.2	(Berkeley)	01/21/83";
4 
5 /*
6  * Close all active files within a dynamic record,
7  * then dispose of the record.
8  */
9 
10 #include "h00vars.h"
11 #include "libpc.h"
12 
13 DFDISPOSE(var, size)
14 	char	**var;	/* pointer to pointer being deallocated */
15 	long	size;	/* sizeof(bletch) */
16 {
17 	register struct iorec	*next, *prev;
18 	struct iorec *start, *end;
19 
20 	start = (struct iorec *)(*var);
21 	end = (struct iorec *)(*var + size);
22 	prev = (struct iorec *)(&_fchain);
23 	next = _fchain.fchain;
24 	while(next != FILNIL && (next->flev < GLVL || next < start)) {
25 		prev = next;
26 		next = next->fchain;
27 	}
28 	while(next != FILNIL && next < end)
29 		next = PFCLOSE(next, TRUE);
30 	prev->fchain = next;
31 	DISPOSE(var, size);
32 }
33