hash_free (semantic_type_table);
free (symbols);
free (symbols_sorted);
+ free (semantic_types_sorted);
}
static void
symbols_do (Hash_processor processor, void *processor_data,
- struct hash_table *table, symbol **sorted)
+ struct hash_table *table, symbol ***sorted)
{
size_t count = hash_get_n_entries (table);
- if (!sorted)
+ if (!*sorted)
{
- sorted = xnmalloc (count, sizeof *sorted);
- hash_get_entries (table, (void**)sorted, count);
- qsort (sorted, count, sizeof *sorted, symbols_cmp_qsort);
+ *sorted = xnmalloc (count, sizeof **sorted);
+ hash_get_entries (table, (void**)*sorted, count);
+ qsort (*sorted, count, sizeof **sorted, symbols_cmp_qsort);
}
{
size_t i;
for (i = 0; i < count; ++i)
- processor (sorted[i], processor_data);
+ processor ((*sorted)[i], processor_data);
}
}
symbols_check_defined (void)
{
symbols_do (symbol_check_defined_processor, NULL,
- symbol_table, symbols_sorted);
+ symbol_table, &symbols_sorted);
symbols_do (semantic_type_check_defined_processor, NULL,
- semantic_type_table, semantic_types_sorted);
+ semantic_type_table, &semantic_types_sorted);
}
/*------------------------------------------------------------------.
for (i = 0; i < max_user_token_number + 1; i++)
token_translations[i] = undeftoken->number;
symbols_do (symbol_translation_processor, NULL,
- symbol_table, symbols_sorted);
+ symbol_table, &symbols_sorted);
}
symbols_pack (void)
{
symbols_do (symbol_check_alias_consistency_processor, NULL,
- symbol_table, symbols_sorted);
+ symbol_table, &symbols_sorted);
symbols = xcalloc (nsyms, sizeof *symbols);
- symbols_do (symbol_pack_processor, NULL, symbol_table, symbols_sorted);
+ symbols_do (symbol_pack_processor, NULL, symbol_table, &symbols_sorted);
/* Aliases leave empty slots in symbols, so remove them. */
{