Commit | Line | Data |
---|---|---|
b8e9ff47 KM |
1 | /* Copyright (c) 1982 Regents of the University of California */ |
2 | ||
660b18d9 | 3 | static char sccsid[] = "@(#)DFDISPOSE.c 4.3 (Berkeley) %G%"; |
b8e9ff47 KM |
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 | } | |
660b18d9 | 28 | while(next != FILNIL && start <= next && next < end) |
9e012f32 | 29 | next = PFCLOSE(next, TRUE); |
b8e9ff47 KM |
30 | prev->fchain = next; |
31 | DISPOSE(var, size); | |
32 | } |