From d9a25bc4ee6da22c002b8a612b8943d29edaa103 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 2 Feb 2025 17:37:43 +0000 Subject: [PATCH] [aat] Allocate caches together No separate malloc. --- src/hb-aat-layout-morx-table.hh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 6e2b33565..689621418 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -919,20 +919,17 @@ struct hb_accelerate_subtables_context_t : friend struct hb_aat_layout_lookup_accelerator_t; public: - hb_aat_class_cache_t *class_cache; + mutable hb_aat_class_cache_t class_cache; template void init (const T &obj_, unsigned num_glyphs) { - class_cache = (hb_aat_class_cache_t *) malloc (sizeof (hb_aat_class_cache_t)); - if (class_cache) - class_cache->clear (); + class_cache.clear (); } void fini () { - free (class_cache); } }; @@ -1145,7 +1142,7 @@ struct Chain hb_map ([&subtable] (const hb_aat_map_t::range_flags_t _) -> bool { return subtable->subFeatureFlags & (_.flags); }))) goto skip; c->subtable_flags = subtable->subFeatureFlags; - c->machine_class_cache = accel ? accel->subtables[i].class_cache : nullptr; + c->machine_class_cache = accel ? &accel->subtables[i].class_cache : nullptr; if (!(subtable->get_coverage() & ChainSubtable::AllDirections) && HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) !=