[bimap] Remove init/fini

This commit is contained in:
Behdad Esfahbod 2022-01-18 09:21:31 -07:00
parent c3dd21f110
commit de2cef42b4
6 changed files with 3 additions and 56 deletions

View File

@ -33,20 +33,6 @@
/* Bi-directional map */ /* Bi-directional map */
struct hb_bimap_t struct hb_bimap_t
{ {
/* XXX(remove) */
void init ()
{
forw_map.init ();
back_map.init ();
}
/* XXX(remove) */
void fini ()
{
forw_map.fini ();
back_map.fini ();
}
void reset () void reset ()
{ {
forw_map.reset (); forw_map.reset ();

View File

@ -2930,8 +2930,6 @@ struct VariationStore
hb_vector_t<hb_inc_bimap_t> inner_maps; hb_vector_t<hb_inc_bimap_t> inner_maps;
inner_maps.resize ((unsigned) dataSets.len); inner_maps.resize ((unsigned) dataSets.len);
for (unsigned i = 0; i < inner_maps.length; i++)
inner_maps[i].init ();
for (unsigned idx : c->plan->layout_variation_indices->iter ()) for (unsigned idx : c->plan->layout_variation_indices->iter ())
{ {
@ -2939,18 +2937,11 @@ struct VariationStore
uint16_t minor = idx & 0xFFFF; uint16_t minor = idx & 0xFFFF;
if (major >= inner_maps.length) if (major >= inner_maps.length)
{
for (unsigned i = 0; i < inner_maps.length; i++)
inner_maps[i].fini ();
return_trace (false); return_trace (false);
}
inner_maps[major].add (minor); inner_maps[major].add (minor);
} }
varstore_prime->serialize (c->serializer, this, inner_maps.as_array ()); varstore_prime->serialize (c->serializer, this, inner_maps.as_array ());
for (unsigned i = 0; i < inner_maps.length; i++)
inner_maps[i].fini ();
return_trace ( return_trace (
!c->serializer->in_error() !c->serializer->in_error()
&& varstore_prime->dataSets); && varstore_prime->dataSets);

View File

@ -177,9 +177,6 @@ struct hvarvvar_subset_plan_t
inner_maps.resize (var_store->get_sub_table_count ()); inner_maps.resize (var_store->get_sub_table_count ());
for (unsigned int i = 0; i < inner_maps.length; i++)
inner_maps[i].init ();
if (unlikely (!index_map_plans.length || !inner_sets.length || !inner_maps.length)) return; if (unlikely (!index_map_plans.length || !inner_sets.length || !inner_maps.length)) return;
bool retain_adv_map = false; bool retain_adv_map = false;
@ -229,8 +226,8 @@ struct hvarvvar_subset_plan_t
for (unsigned int i = 0; i < inner_sets.length; i++) for (unsigned int i = 0; i < inner_sets.length; i++)
hb_set_destroy (inner_sets[i]); hb_set_destroy (inner_sets[i]);
hb_set_destroy (adv_set); hb_set_destroy (adv_set);
inner_maps.fini_deep (); inner_maps.fini ();
index_map_plans.fini_deep (); index_map_plans.fini ();
} }
hb_inc_bimap_t outer_map; hb_inc_bimap_t outer_map;

View File

@ -526,19 +526,9 @@ struct subr_remap_t : hb_inc_bimap_t
struct subr_remaps_t struct subr_remaps_t
{ {
subr_remaps_t ()
{
global_remap.init ();
local_remaps.init ();
}
~subr_remaps_t () { fini (); }
void init (unsigned int fdCount) void init (unsigned int fdCount)
{ {
if (unlikely (!local_remaps.resize (fdCount))) return; local_remaps.resize (fdCount);
for (unsigned int i = 0; i < fdCount; i++)
local_remaps[i].init ();
} }
bool in_error() bool in_error()
@ -553,12 +543,6 @@ struct subr_remaps_t
local_remaps[i].create (closures.local_closures[i]); local_remaps[i].create (closures.local_closures[i]);
} }
void fini ()
{
global_remap.fini ();
local_remaps.fini_deep ();
}
subr_remap_t global_remap; subr_remap_t global_remap;
hb_vector_t<subr_remap_t> local_remaps; hb_vector_t<subr_remap_t> local_remaps;
}; };
@ -577,7 +561,6 @@ struct subr_subsetter_t
~subr_subsetter_t () ~subr_subsetter_t ()
{ {
closures.fini (); closures.fini ();
remaps.fini ();
parsed_charstrings.fini_deep (); parsed_charstrings.fini_deep ();
parsed_global_subrs.fini_deep (); parsed_global_subrs.fini_deep ();
parsed_local_subrs.fini_deep (); parsed_local_subrs.fini_deep ();

View File

@ -371,14 +371,10 @@ struct cff_subset_plan {
{ {
topdict_mod.init (); topdict_mod.init ();
subset_fdselect_ranges.init (); subset_fdselect_ranges.init ();
fdmap.init ();
subset_charstrings.init (); subset_charstrings.init ();
subset_globalsubrs.init (); subset_globalsubrs.init ();
subset_localsubrs.init ();
fontdicts_mod.init ();
subset_enc_code_ranges.init (); subset_enc_code_ranges.init ();
subset_charset_ranges.init (); subset_charset_ranges.init ();
sidmap.init ();
for (unsigned int i = 0; i < name_dict_values_t::ValCount; i++) for (unsigned int i = 0; i < name_dict_values_t::ValCount; i++)
topDictModSIDs[i] = CFF_UNDEF_SID; topDictModSIDs[i] = CFF_UNDEF_SID;
} }
@ -387,14 +383,10 @@ struct cff_subset_plan {
{ {
topdict_mod.fini (); topdict_mod.fini ();
subset_fdselect_ranges.fini (); subset_fdselect_ranges.fini ();
fdmap.fini ();
subset_charstrings.fini_deep (); subset_charstrings.fini_deep ();
subset_globalsubrs.fini_deep (); subset_globalsubrs.fini_deep ();
subset_localsubrs.fini_deep ();
fontdicts_mod.fini ();
subset_enc_code_ranges.fini (); subset_enc_code_ranges.fini ();
subset_charset_ranges.fini (); subset_charset_ranges.fini ();
sidmap.fini ();
} }
void plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan) void plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)

View File

@ -242,7 +242,6 @@ struct cff2_subset_plan {
desubroutinize (false) desubroutinize (false)
{ {
subset_fdselect_ranges.init (); subset_fdselect_ranges.init ();
fdmap.init ();
subset_charstrings.init (); subset_charstrings.init ();
subset_globalsubrs.init (); subset_globalsubrs.init ();
subset_localsubrs.init (); subset_localsubrs.init ();
@ -251,7 +250,6 @@ struct cff2_subset_plan {
~cff2_subset_plan () ~cff2_subset_plan ()
{ {
subset_fdselect_ranges.fini (); subset_fdselect_ranges.fini ();
fdmap.fini ();
subset_charstrings.fini_deep (); subset_charstrings.fini_deep ();
subset_globalsubrs.fini_deep (); subset_globalsubrs.fini_deep ();
subset_localsubrs.fini_deep (); subset_localsubrs.fini_deep ();