| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

sym_empty_table

#include "sflsymb.h"
void
sym_empty_table (
    SYMTAB *table)                      /*  Symbol table to empty            */

Synopsis

Empties the given symbol table, by deleting all symbols. You can then add new symbols. If the table argument is NULL, does nothing.

Source Code - (sflsymb.c)

{
    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;
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation