|
|
1.1 root 1: # include "ctlmod.h"
2: # include <ingres.h>
3: # include <tree.h>
4: # include <sccs.h>
5:
6: SCCSID(@(#)resetp.c 7.1 2/5/81)
7:
8: /*
9: ** RESETP -- reset parameters from call.
10: **
11: ** This must be called after an initp-setp-call sequence to
12: ** reclaim the memory gathered by the initp. It can also be
13: ** used in an initp-setp sequence to clean up if an error is
14: ** found.
15: **
16: ** Parameters:
17: ** none.
18: **
19: ** Returns:
20: ** none.
21: **
22: ** Side Effects:
23: ** Restores the old context.
24: ** Reclaims space from Qbuf.
25: **
26: ** Trace Flags:
27: ** 4.4 - 4.7
28: */
29:
30: resetp()
31: {
32: extern char *Proc_name;
33:
34: # ifdef xCTR1
35: if (tTf(4, 4))
36: printf("resetp: ctx_new=%d _init=%d _link=%x _pmark=%d _cmark=%d\n",
37: Ctx.ctx_new, Ctx.ctx_init, Ctx.ctx_link, Ctx.ctx_pmark,
38: Ctx.ctx_cmark);
39: # endif
40:
41: /* don't do anything if no matching "initp" call */
42: if (!Ctx.ctx_new)
43: return;
44:
45: /*
46: ** The 'freebuf' to ctx_cmark will also deallocate
47: ** any parameters, since ctx_pmark >= ctx_cmark
48: ** always.
49: */
50:
51: if (Ctx.ctx_link != NULL)
52: bmove((char *) Ctx.ctx_link, (char *) &Ctx, Ctx.ctx_size);
53: # ifdef xCM_DEBUG
54: if (Ctx.ctx_pmark < Ctx.ctx_cmark)
55: syserr("resetp: pmark %d cmark %d", Ctx.ctx_pmark, Ctx.ctx_cmark);
56: # endif
57: freebuf(Qbuf, Ctx.ctx_cmark);
58: tT = Ctx.ctx_tvect;
59: Proc_name = Ctx.ctx_name;
60: # ifdef xCTR1
61: if (tTf(4, 5))
62: lprintf("resetp: free %d\n", Ctx.ctx_cmark);
63: # endif
64:
65: /*
66: ** If there was a Qt associated with this context,
67: ** restore it also. If not, but there was a Qt
68: ** associated with the context we just deallocated,
69: ** set Qt to be 'unallocated'.
70: */
71: if (Ctx.ctx_qt != NULL)
72: {
73: /* first free any descriptors */
74: clrrange();
75: bmove((char *) Ctx.ctx_qt, (char *) &Qt, sizeof Qt);
76: free(Ctx.ctx_qt);
77: Ctx.ctx_qt = NULL;
78: }
79: else if (Qt.qt_ctx == NULL)
80: Qt.qt_active = 0;
81: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.