1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifndef lint
8: static char sccsid[] = "@(#)delwin.c 5.1 (Berkeley) 6/7/85";
9: #endif not lint
10:
11: # include "curses.ext"
12:
13: /*
14: * This routine deletes a window and releases it back to the system.
15: *
16: */
17: delwin(win)
18: reg WINDOW *win; {
19:
20: reg int i;
21: reg WINDOW *wp, *np;
22:
23: if (win->_orig == NULL) {
24: /*
25: * If we are the original window, delete the space for
26: * all the subwindows, and the array of space as well.
27: */
28: for (i = 0; i < win->_maxy && win->_y[i]; i++)
29: free(win->_y[i]);
30: free(win->_firstch);
31: free(win->_lastch);
32: wp = win->_nextp;
33: while (wp != win) {
34: np = wp->_nextp;
35: delwin(wp);
36: wp = np;
37: }
38: }
39: else {
40: /*
41: * If we are a subwindow, take ourselves out of the
42: * list. NOTE: if we are a subwindow, the minimum list
43: * is orig followed by this subwindow, so there are
44: * always at least two windows in the list.
45: */
46: for (wp = win->_nextp; wp->_nextp != win; wp = wp->_nextp)
47: continue;
48: wp->_nextp = win->_nextp;
49: }
50: free(win->_y);
51: free(win);
52: }
Defined functions
delwin
defined in line
17; used 10 times
Defined variables
sccsid
defined in line
8;
never used