-void init_type_identify(void) {
- //type_table = new_pset ((int (const void *, const void *))compare_types_func, 8);
+/* The function that hashes a type. */
+type *mature_type_free(type *tp) {
+ type *o;
+
+ assert(type_table);
+
+ o = pset_insert (type_table, tp, hash_types_func(tp) );
+
+ if (!o || o == tp) return tp;
+
+ free_type_entities(tp);
+ free_type(tp);
+
+ return o;
+}
+
+/* The function that hashes a type. */
+type *mature_type_free_entities(type *tp) {
+ type *o;
+
+ assert(type_table);
+
+ o = pset_insert (type_table, tp, hash_types_func(tp) );
+
+ if (!o || o == tp) return tp;
+
+ free_type_entities(tp);
+ exchange_types(tp, o);
+
+ return o;
+}
+
+/* initialize this module */
+void init_type_identify(type_identify_if_t *ti_if) {
+ compare_types_func = ti_if && ti_if->cmp ? ti_if->cmp : compare_strict;
+ hash_types_func = ti_if && ti_if->hash ? ti_if->hash : firm_hash_name;