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[] = "@(#)tfree.c	5.1 (Berkeley) 6/6/85";
   9: #endif not lint
  10: 
  11: /*
  12:  * Free a tree; this is expensive but useful.
  13:  */
  14: 
  15: #include "defs.h"
  16: #include "tree.h"
  17: #include "sym.h"
  18: #include "tree.rep"
  19: 
  20: tfree(p)
  21: register NODE *p;
  22: {
  23:     if (p == NIL) {
  24:         return;
  25:     }
  26:     switch(degree(p->op)) {
  27:         case LEAF:
  28:             switch(p->op) {
  29:                 case O_CALL:
  30:                     tfree(p->left);
  31:                     tfree(p->right);
  32:                     break;
  33: 
  34:                 case O_QLINE:
  35:                     dispose(p->left->sconval);
  36:                     dispose(p->left);
  37:                     tfree(p->right);
  38:                     break;
  39: 
  40:                 case O_ALIAS:
  41:                     dispose(p->left->sconval);
  42:                     dispose(p->left);
  43:                     dispose(p->right->sconval);
  44:                     dispose(p->right);
  45:                     break;
  46: 
  47:                 case O_SCON:
  48:                     unmkstring(p->nodetype);
  49:                     free(p->nodetype);
  50:                     free(p->sconval);
  51:                     p->sconval = NIL;
  52:                     break;
  53:             }
  54:             break;
  55: 
  56:         case BINARY:
  57:             tfree(p->right);
  58:             /* fall through */
  59:         case UNARY:
  60:             tfree(p->left);
  61:             break;
  62: 
  63:         default:
  64:             panic("bad op %d in tfree", p->op);
  65:     }
  66:     dispose(p);
  67: }

Defined functions

tfree defined in line 20; used 8 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-06-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 777
Valid CSS Valid XHTML 1.0 Strict