-/* Copyright (C) 2003 MORIOKA Tomohiko
+/* Copyright (C) 2003,2004 MORIOKA Tomohiko
This file is part of the CHISE Library.
The CHISE Library is free software; you can redistribute it and/or
}
void
-chise_destroy_hash_table (CHISE_HASH_TABLE* hash)
+chise_destroy_hash_table (CHISE_HASH_TABLE* table)
{
- if (hash == NULL)
+ if (table == NULL)
return;
- free (hash->data);
- free (hash);
+ free (table->data);
+ free (table);
}
CHISE_NAME_TABLE*
chise_make_name_table ()
{
- return chise_make_hash_table (32);
+ return chise_make_hash_table (256);
}
void
chise_destroy_name_table (CHISE_NAME_TABLE* table)
{
+ int i;
+
+ for (i = 0; i < table->size; i++)
+ {
+ CHISE_NAME_TABLE_ENTRY entry = table->data[i];
+
+ if (entry.key != NULL)
+ {
+ if (entry.value != NULL)
+ free (entry.value);
+ free (entry.key);
+ }
+ }
chise_destroy_hash_table (table);
}
chise_name_table_grow (CHISE_NAME_TABLE* table)
{
CHISE_NAME_TABLE *new_table
- = chise_make_hash_table (table->size * 2);
+ = chise_make_hash_table ( table->size * 2
+ /* - (table->size * 4 / 5) */ );
int i;
if (new_table == NULL)