|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflsymb.h"
void
sym_empty_table (
SYMTAB *table) /* Symbol table to empty */
Empties the given symbol table, by deleting all symbols. You can then add new symbols. If the table argument is NULL, does nothing.
{
SYMBOL
*symbol, /* Pointer to symbol */
*next = NULL; /* and to next symbol in list */
int
hash_index; /* Index into hash bucket */
if (!table)
return; /* Do nothing if argument is null */
for (symbol = table-> symbols; symbol; symbol = next)
{
next = symbol-> next; /* Keep track of next in list */
mem_free (symbol-> value); /* Free value if used */
mem_free (symbol); /* Finally free symbol and name */
}
table-> symbols = NULL; /* No symbols attached yet */
table-> size = 0;
for (hash_index = 0; hash_index < SYM_HASH_SIZE; hash_index++)
table-> hash [hash_index] = NULL;
}
| | << | < | > | >> |
|