[subset] Convert another use of hashmap to unique_ptr
This commit is contained in:
parent
25f57230d5
commit
f13a79548f
|
@ -102,7 +102,7 @@ static void ClassDef_remap_and_serialize (
|
|||
struct hb_prune_langsys_context_t
|
||||
{
|
||||
hb_prune_langsys_context_t (const void *table_,
|
||||
hb_hashmap_t<unsigned, hb_set_t *> *script_langsys_map_,
|
||||
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map_,
|
||||
const hb_map_t *duplicate_feature_map_,
|
||||
hb_set_t *new_collected_feature_indexes_)
|
||||
:table (table_),
|
||||
|
@ -122,7 +122,7 @@ struct hb_prune_langsys_context_t
|
|||
|
||||
public:
|
||||
const void *table;
|
||||
hb_hashmap_t<unsigned, hb_set_t *> *script_langsys_map;
|
||||
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map;
|
||||
const hb_map_t *duplicate_feature_map;
|
||||
hb_set_t *new_feature_indexes;
|
||||
|
||||
|
@ -162,14 +162,14 @@ struct hb_subset_layout_context_t :
|
|||
hb_subset_context_t *subset_context;
|
||||
const hb_tag_t table_tag;
|
||||
const hb_map_t *lookup_index_map;
|
||||
const hb_hashmap_t<unsigned, hb_set_t *> *script_langsys_map;
|
||||
const hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map;
|
||||
const hb_map_t *feature_index_map;
|
||||
unsigned cur_script_index;
|
||||
|
||||
hb_subset_layout_context_t (hb_subset_context_t *c_,
|
||||
hb_tag_t tag_,
|
||||
hb_map_t *lookup_map_,
|
||||
hb_hashmap_t<unsigned, hb_set_t *> *script_langsys_map_,
|
||||
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map_,
|
||||
hb_map_t *feature_index_map_) :
|
||||
subset_context (c_),
|
||||
table_tag (tag_),
|
||||
|
@ -723,12 +723,8 @@ struct Script
|
|||
|
||||
if (!c->script_langsys_map->has (script_index))
|
||||
{
|
||||
hb_set_t* empty_set = hb_set_create ();
|
||||
if (unlikely (!c->script_langsys_map->set (script_index, empty_set)))
|
||||
{
|
||||
hb_set_destroy (empty_set);
|
||||
if (unlikely (!c->script_langsys_map->set (script_index, hb::unique_ptr<hb_set_t> {hb_set_create ()})))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned langsys_count = get_lang_sys_count ();
|
||||
|
|
|
@ -3729,7 +3729,7 @@ struct GSUBGPOS
|
|||
}
|
||||
|
||||
void prune_langsys (const hb_map_t *duplicate_feature_map,
|
||||
hb_hashmap_t<unsigned, hb_set_t *> *script_langsys_map,
|
||||
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map,
|
||||
hb_set_t *new_feature_indexes /* OUT */) const
|
||||
{
|
||||
hb_prune_langsys_context_t c (this, script_langsys_map, duplicate_feature_map, new_feature_indexes);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
using OT::Layout::GSUB::GSUB;
|
||||
|
||||
|
||||
typedef hb_hashmap_t<unsigned, hb_set_t *> script_langsys_map;
|
||||
typedef hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> script_langsys_map;
|
||||
#ifndef HB_NO_SUBSET_CFF
|
||||
static inline void
|
||||
_add_cff_seac_components (const OT::cff1::accelerator_t &cff,
|
||||
|
@ -630,9 +630,6 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
|
|||
|
||||
if (plan->gsub_langsys)
|
||||
{
|
||||
for (auto _ : plan->gsub_langsys->iter ())
|
||||
hb_set_destroy (_.second);
|
||||
|
||||
hb_object_destroy (plan->gsub_langsys);
|
||||
plan->gsub_langsys->fini_shallow ();
|
||||
hb_free (plan->gsub_langsys);
|
||||
|
@ -640,9 +637,6 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
|
|||
|
||||
if (plan->gpos_langsys)
|
||||
{
|
||||
for (auto _ : plan->gpos_langsys->iter ())
|
||||
hb_set_destroy (_.second);
|
||||
|
||||
hb_object_destroy (plan->gpos_langsys);
|
||||
plan->gpos_langsys->fini_shallow ();
|
||||
hb_free (plan->gpos_langsys);
|
||||
|
|
|
@ -87,8 +87,8 @@ struct hb_subset_plan_t
|
|||
hb_map_t *gpos_lookups;
|
||||
|
||||
//active langsys we'd like to retain
|
||||
hb_hashmap_t<unsigned, hb_set_t *> *gsub_langsys;
|
||||
hb_hashmap_t<unsigned, hb_set_t *> *gpos_langsys;
|
||||
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *gsub_langsys;
|
||||
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *gpos_langsys;
|
||||
|
||||
//active features after removing redundant langsys and prune_features
|
||||
hb_map_t *gsub_features;
|
||||
|
|
Loading…
Reference in New Issue