Use shared_ptr<hb_set_t> in one place

See if valgrind is happy...
This commit is contained in:
Behdad Esfahbod 2022-06-02 11:29:44 -06:00
parent a42a703cb6
commit e9407a2bd2
3 changed files with 6 additions and 15 deletions

View File

@ -198,7 +198,7 @@ struct hb_hashmap_t
return true;
}
bool set (K key, const V& value) { return set_with_hash (key, hb_hash (key), value); }
bool set (K key, const V &value) { return set_with_hash (key, hb_hash (key), value); }
bool set (K key, V&& value) { return set_with_hash (key, hb_hash (key), std::move (value)); }
V get (K key) const

View File

@ -111,12 +111,9 @@ struct hb_closure_context_t :
if (!done_lookups_glyph_set->get (lookup_index))
{
hb_set_t* empty_set = hb_set_create ();
hb::shared_ptr<hb_set_t> empty_set {hb_set_create ()};
if (unlikely (!done_lookups_glyph_set->set (lookup_index, empty_set)))
{
hb_set_destroy (empty_set);
return true;
}
}
hb_set_clear (done_lookups_glyph_set->get (lookup_index));
@ -171,7 +168,7 @@ struct hb_closure_context_t :
hb_closure_context_t (hb_face_t *face_,
hb_set_t *glyphs_,
hb_map_t *done_lookups_glyph_count_,
hb_hashmap_t<unsigned, hb_set_t *> *done_lookups_glyph_set_,
hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *done_lookups_glyph_set_,
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
face (face_),
glyphs (glyphs_),
@ -195,7 +192,7 @@ struct hb_closure_context_t :
private:
hb_map_t *done_lookups_glyph_count;
hb_hashmap_t<unsigned, hb_set_t *> *done_lookups_glyph_set;
hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> *done_lookups_glyph_set;
unsigned int lookup_count = 0;
};

View File

@ -1501,15 +1501,12 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
hb_set_t *glyphs /* OUT */)
{
hb_map_t done_lookups_glyph_count;
hb_hashmap_t<unsigned, hb_set_t *> done_lookups_glyph_set;
hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> done_lookups_glyph_set;
OT::hb_closure_context_t c (face, glyphs, &done_lookups_glyph_count, &done_lookups_glyph_set);
const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index);
l.closure (&c, lookup_index);
for (auto _ : done_lookups_glyph_set.iter ())
hb_set_destroy (_.second);
}
/**
@ -1529,7 +1526,7 @@ hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
hb_set_t *glyphs /* OUT */)
{
hb_map_t done_lookups_glyph_count;
hb_hashmap_t<unsigned, hb_set_t *> done_lookups_glyph_set;
hb_hashmap_t<unsigned, hb::shared_ptr<hb_set_t>> done_lookups_glyph_set;
OT::hb_closure_context_t c (face, glyphs, &done_lookups_glyph_count, &done_lookups_glyph_set);
const GSUB& gsub = *face->table.GSUB->table;
@ -1551,9 +1548,6 @@ hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
}
} while (iteration_count++ <= HB_CLOSURE_MAX_STAGES &&
glyphs_length != glyphs->get_population ());
for (auto _ : done_lookups_glyph_set.iter ())
hb_set_destroy (_.second);
}
/*