[subset-plan] Simplify gsub_lookups and gpos_lookups allocation
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index 71eb182..71fd205 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -156,7 +156,7 @@
   {
     if (tag_ == HB_OT_TAG_GSUB)
     {
-      lookup_index_map = c_->plan->gsub_lookups;
+      lookup_index_map = &c_->plan->gsub_lookups;
       script_langsys_map = c_->plan->gsub_langsys;
       feature_index_map = &c_->plan->gsub_features;
       feature_substitutes_map = c_->plan->gsub_feature_substitutes_map;
@@ -164,7 +164,7 @@
     }
     else
     {
-      lookup_index_map = c_->plan->gpos_lookups;
+      lookup_index_map = &c_->plan->gpos_lookups;
       script_langsys_map = c_->plan->gpos_langsys;
       feature_index_map = &c_->plan->gpos_features;
       feature_substitutes_map = c_->plan->gpos_feature_substitutes_map;
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
index 4413784..9bcdc9c 100644
--- a/src/hb-ot-layout-gsubgpos.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -2223,7 +2223,7 @@
     if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
     out->format = format;
 
-    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
+    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
     hb_sorted_vector_t<hb_codepoint_t> new_coverage;
     + hb_zip (this+coverage, ruleSet)
     | hb_filter (glyphset, hb_first)
@@ -2460,7 +2460,7 @@
     hb_set_t coverage_glyph_classes;
     (this+classDef).intersected_classes (&retained_coverage_glyphs, &coverage_glyph_classes);
 
-    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
+    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
     bool ret = true;
     int non_zero_index = -1, index = 0;
     auto snapshot = c->serializer->snapshot();
@@ -2640,7 +2640,7 @@
     }
 
     const auto& lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>> (coverageZ.as_array (glyphCount));
-    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
+    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
 
 
     unsigned count = serialize_lookuprecord_array (c->serializer, lookupRecord.as_array (lookupCount), lookup_map);
@@ -3304,7 +3304,7 @@
     if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
     out->format = format;
 
-    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
+    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
     hb_sorted_vector_t<hb_codepoint_t> new_coverage;
     + hb_zip (this+coverage, ruleSet)
     | hb_filter (glyphset, hb_first)
@@ -3584,7 +3584,7 @@
 
     int non_zero_index = -1, index = 0;
     bool ret = true;
-    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
+    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
     auto last_non_zero = c->serializer->snapshot ();
     for (const auto& _ : + hb_enumerate (ruleSet)
 			 | hb_filter (input_klass_map, hb_first))
@@ -3826,7 +3826,7 @@
       return_trace (false);
 
     const auto &lookup = StructAfter<decltype (lookupX)> (lookahead);
-    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
+    const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? &c->plan->gsub_lookups : &c->plan->gpos_lookups;
 
     HBUINT16 *lookupCount = c->serializer->copy<HBUINT16> (lookup.len);
     if (!lookupCount) return_trace (false);
diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index 895188f..1d09983 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -383,7 +383,7 @@
                                                 plan->layout_variation_idx_delta_map,
                                                 font, var_store,
                                                 plan->_glyphset_gsub,
-                                                plan->gpos_lookups,
+                                                &plan->gpos_lookups,
                                                 store_cache);
   gdef->collect_variation_indices (&c);
 
@@ -629,7 +629,7 @@
     _closure_glyphs_lookups_features<GSUB> (
         plan,
         plan->_glyphset_gsub,
-        plan->gsub_lookups,
+        &plan->gsub_lookups,
         &plan->gsub_features,
         plan->gsub_langsys,
         plan->gsub_feature_record_cond_idx_map,
@@ -639,7 +639,7 @@
     _closure_glyphs_lookups_features<GPOS> (
         plan,
         plan->_glyphset_gsub,
-        plan->gpos_lookups,
+        &plan->gpos_lookups,
         &plan->gpos_features,
         plan->gpos_langsys,
         plan->gpos_feature_record_cond_idx_map,
@@ -860,8 +860,6 @@
   plan->glyph_map = hb_map_create ();
   plan->reverse_glyph_map = hb_map_create ();
   plan->glyph_map_gsub = hb_map_create ();
-  plan->gsub_lookups = hb_map_create ();
-  plan->gpos_lookups = hb_map_create ();
 
   plan->check_success (plan->gsub_langsys = hb_hashmap_create<unsigned, hb::unique_ptr<hb_set_t>> ());
   plan->check_success (plan->gpos_langsys = hb_hashmap_create<unsigned, hb::unique_ptr<hb_set_t>> ());
diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh
index 48b2f917..432a471 100644
--- a/src/hb-subset-plan.hh
+++ b/src/hb-subset-plan.hh
@@ -62,8 +62,6 @@
     hb_set_destroy (_glyphset_gsub);
     hb_set_destroy (_glyphset_mathed);
     hb_set_destroy (_glyphset_colred);
-    hb_map_destroy (gsub_lookups);
-    hb_map_destroy (gpos_lookups);
     hb_map_destroy (colrv1_layers);
     hb_map_destroy (colr_palettes);
     hb_map_destroy (axes_index_map);
@@ -151,8 +149,8 @@
   hb_set_t *_glyphset_colred;
 
   //active lookups we'd like to retain
-  hb_map_t *gsub_lookups;
-  hb_map_t *gpos_lookups;
+  hb_map_t gsub_lookups;
+  hb_map_t gpos_lookups;
 
   //active langsys we'd like to retain
   hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *gsub_langsys;