Annotation of 43BSD/ingres/source/ctlmod/resetp.c, revision 1.1.1.1

1.1       root        1: # include      "ctlmod.h"
                      2: # include      <ingres.h>
                      3: # include      <tree.h>
                      4: # include      <sccs.h>
                      5: 
                      6: SCCSID(@(#)resetp.c    8.2     12/8/85)
                      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:        /* If the Current Qt header matches the new context clean things up */
                     46:        if ((char *)Ctx.ctx_link == Qt.qt_ctx)
                     47:                Qt.qt_ctx = NULL;
                     48: 
                     49:        /*
                     50:        **      The 'freebuf' to ctx_cmark will also deallocate
                     51:        **      any parameters, since ctx_pmark >= ctx_cmark
                     52:        **      always.
                     53:        */
                     54: 
                     55:        if (Ctx.ctx_link != NULL)
                     56:                bmove((char *) Ctx.ctx_link, (char *) &Ctx, Ctx.ctx_size);
                     57: # ifdef xCM_DEBUG
                     58:        if (Ctx.ctx_pmark < Ctx.ctx_cmark)
                     59:                syserr("resetp: pmark %d cmark %d", Ctx.ctx_pmark, Ctx.ctx_cmark);
                     60: # endif
                     61:        freebuf(Qbuf, Ctx.ctx_cmark);
                     62:        tT = Ctx.ctx_tvect;
                     63:        Proc_name = Ctx.ctx_name;
                     64: # ifdef xCTR1
                     65:        if (tTf(4, 5))
                     66:                lprintf("resetp: free %d\n", Ctx.ctx_cmark);
                     67: # endif
                     68: 
                     69:        /*
                     70:        **      If there was a Qt associated with this context,
                     71:        **      restore it also.  If not, but there was a Qt
                     72:        **      associated with the context we just deallocated,
                     73:        **      set Qt to be 'unallocated'.
                     74:        */
                     75:        if (Ctx.ctx_qt != NULL)
                     76:        {
                     77:                /* first free any descriptors */
                     78:                clrrange();
                     79:                bmove((char *) Ctx.ctx_qt, (char *) &Qt, sizeof Qt);
                     80:                free(Ctx.ctx_qt);
                     81:                Ctx.ctx_qt = NULL;
                     82:        }
                     83:        else if (Qt.qt_ctx == NULL)
                     84:                Qt.qt_active = 0;
                     85: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.