Fix set initialization issues
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 4abd4b7..e695d78 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -160,7 +160,7 @@
return HB_VOID;
/* Return if new lookup was recursed to before. */
- if (recursed_lookups.has (lookup_index))
+ if (recursed_lookups->has (lookup_index))
return HB_VOID;
hb_set_t *old_before = before;
@@ -176,7 +176,7 @@
input = old_input;
after = old_after;
- recursed_lookups.add (lookup_index);
+ recursed_lookups->add (lookup_index);
return HB_VOID;
}
@@ -187,7 +187,7 @@
hb_set_t *after;
hb_set_t *output;
recurse_func_t recurse_func;
- hb_set_t recursed_lookups;
+ hb_set_t *recursed_lookups;
unsigned int nesting_level_left;
unsigned int debug_depth;
@@ -203,15 +203,15 @@
after (glyphs_after ? glyphs_after : hb_set_get_empty ()),
output (glyphs_output ? glyphs_output : hb_set_get_empty ()),
recurse_func (nullptr),
- recursed_lookups (),
+ recursed_lookups (nullptr),
nesting_level_left (nesting_level_left_),
debug_depth (0)
{
- recursed_lookups.init ();
+ recursed_lookups = hb_set_create ();
}
~hb_collect_glyphs_context_t (void)
{
- recursed_lookups.fini ();
+ hb_set_destroy (recursed_lookups);
}
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 9d1d6f7..624132d 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -939,18 +939,19 @@
for (unsigned int i = 0; i < count; i++)
add_char (font, buffer->unicode, mirror, info[i].codepoint, glyphs);
- hb_set_t lookups;
- lookups.init ();
- hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, &lookups);
+ hb_set_t *lookups = hb_set_create ();
+ hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, lookups);
/* And find transitive closure. */
- hb_set_t copy;
- copy.init ();
+ hb_set_t *copy = hb_set_create ();
do {
- copy.set (glyphs);
- for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index);)
+ copy->set (glyphs);
+ for (hb_codepoint_t lookup_index = -1; hb_set_next (lookups, &lookup_index);)
hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
- } while (!copy.is_equal (glyphs));
+ } while (!copy->is_equal (glyphs));
+ hb_set_destroy (copy);
+
+ hb_set_destroy (lookups);
hb_shape_plan_destroy (shape_plan);
}
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 689766c..9e0c11e 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -175,15 +175,6 @@
return true;
}
- inline void init (void) {
- hb_object_init (this);
- page_map.init ();
- pages.init ();
- }
- inline void fini (void) {
- page_map.finish ();
- pages.finish ();
- }
inline void clear (void) {
if (unlikely (hb_object_is_inert (this)))
return;
diff --git a/src/hb-set.cc b/src/hb-set.cc
index d33e525..e2c7882 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -45,7 +45,8 @@
if (!(set = hb_object_create<hb_set_t> ()))
return hb_set_get_empty ();
- set->clear ();
+ set->page_map.init ();
+ set->pages.init ();
return set;
}
@@ -95,7 +96,8 @@
{
if (!hb_object_destroy (set)) return;
- set->fini ();
+ set->page_map.finish ();
+ set->pages.finish ();
free (set);
}