From a7a688616ab348a66873df5577eec66a0f70206f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 2 Jun 2022 18:59:15 -0600 Subject: [PATCH] [cmap] Convert another map use to unique_ptr --- src/hb-ot-cmap-table.hh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 7e96d9c8b..9d95f518c 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1476,26 +1476,17 @@ struct SubtableUnicodesCache { private: const void* base; - hb_hashmap_t cached_unicodes; + hb_hashmap_t> cached_unicodes; public: SubtableUnicodesCache(const void* cmap_base) : base(cmap_base), cached_unicodes() {} - ~SubtableUnicodesCache() - { - for (hb_set_t* s : cached_unicodes.values()) { - hb_set_destroy (s); - } - } hb_set_t* set_for(const EncodingRecord* record) { if (!cached_unicodes.has ((intptr_t) record)) { - hb_set_t* new_set = hb_set_create (); - if (!cached_unicodes.set ((intptr_t) record, new_set)) { - hb_set_destroy (new_set); + if (!cached_unicodes.set ((intptr_t) record, hb::unique_ptr {hb_set_create ()})) return hb_set_get_empty (); - } (base+record->subtable).collect_unicodes (cached_unicodes.get ((intptr_t) record)); } return cached_unicodes.get ((intptr_t) record);