/* -*-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
*
*/
p = t->a[i];
while (p) {
q = p->next;
+ free(p->name);
free(p);
p = q;
}
}
+ free(t->a);
}
/* --- @sym_find@ --- *
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])
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)
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");
case 3: {
sym_base *b;
int v = rand() & 255 ? 0 : 1;
+ break;
printf("dump\n");
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--;