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