Fix copyright date.
[become] / src / sym.c
index d882f5f..99ec187 100644 (file)
--- a/src/sym.c
+++ b/src/sym.c
@@ -1,13 +1,13 @@
 /* -*-c-*-
  *
- * $Id: sym.c,v 1.1 1997/07/21 13:47:44 mdw Exp $
+ * $Id: sym.c,v 1.4 1998/01/12 16:46:28 mdw Exp $
  *
  * Symbol table management
  *
- * (c) 1996 Straylight
+ * (c) 1998 Straylight
  */
 
-/*----- Licencing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of `become'
  *
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with `become'; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with `become'; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: sym.c,v $
- * Revision 1.1  1997/07/21 13:47:44  mdw
+ * Revision 1.4  1998/01/12 16:46:28  mdw
+ * Fix copyright date.
+ *
+ * Revision 1.3  1997/08/20  16:22:59  mdw
+ * Patch memory leak.
+ *
+ * Revision 1.2  1997/08/04 10:24:25  mdw
+ * Sources placed under CVS control.
+ *
+ * Revision 1.1  1997/07/21  13:47:44  mdw
  * Initial revision
  *
  */
@@ -230,10 +239,12 @@ void sym_destroyTable(sym_table *t)
     p = t->a[i];
     while (p) {
       q = p->next;
+      free(p->name);
       free(p);
       p = q;
     }
   }
+  free(t->a);
 }
 
 /* --- @sym_find@ --- *
@@ -575,7 +586,10 @@ int main(void)
       case 0: {
        sym_word *w;
 
-       printf("find `%s'\n", line[i]);
+       /* printf("find `%s'\n", line[i]); */
+       if ((rand() & 1023) == 0) {
+         putchar('.'); fflush(stdout);
+       }
 
        w = sym_find(&tbl, line[i], -1, 0, 0);
        if (w != flag[i])
@@ -590,7 +604,10 @@ int main(void)
        unsigned f;
        sym_word *w;
 
-       printf("create `%s'\n", line[i]);
+       /* printf("create `%s'\n", line[i]); */
+       if ((rand() & 1023) == 0) {
+         putchar('+'); fflush(stdout);
+       }
 
        w = sym_find(&tbl, line[i], -1, sizeof(sym_word), &f);
        if (f)
@@ -618,6 +635,11 @@ int main(void)
       case 2: {
        sym_iter it;
        sym_word *w, **ntbl;
+       int v = (rand() % entries) == 0;
+       if (!v)
+         break;
+       printf("\niterated %i entries\n", entries);
+       break;
 
        printf("iterate\n");
 
@@ -641,6 +663,7 @@ int main(void)
       case 3: {
        sym_base *b;
        int v = rand() & 255 ? 0 : 1;
+       break;
 
        printf("dump\n");
 
@@ -663,7 +686,10 @@ int main(void)
 
       case 4: {
        if (flag[i]) {
-         printf("remove `%s'\n", flag[i]->base.name);
+         /* printf("remove `%s'\n", flag[i]->base.name); */
+         if ((rand() & 1023) == 0) {
+           putchar('-'); fflush(stdout);
+         }
          sym_remove(&tbl, flag[i]);
          flag[i] = 0;
          entries--;