[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Oct 22 21:48:20 UTC 2017


 src/hb-ot-layout-gsubgpos-private.hh |   12 ++++++------
 src/hb-ot-shape.cc                   |   17 +++++++++--------
 src/hb-set-private.hh                |    9 ---------
 src/hb-set.cc                        |    6 ++++--
 4 files changed, 19 insertions(+), 25 deletions(-)

New commits:
commit 8b9d9b71b04c9d5698ec146658b31381060c700d
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Oct 22 17:48:06 2017 -0400

    Fix set initialization issues

diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 4abd4b71..e695d788 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -160,7 +160,7 @@ struct hb_collect_glyphs_context_t :
       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 @@ struct hb_collect_glyphs_context_t :
     input  = old_input;
     after  = old_after;
 
-    recursed_lookups.add (lookup_index);
+    recursed_lookups->add (lookup_index);
 
     return HB_VOID;
   }
@@ -187,7 +187,7 @@ struct hb_collect_glyphs_context_t :
   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 @@ struct hb_collect_glyphs_context_t :
 			      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 9d1d6f74..624132d8 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -939,18 +939,19 @@ hb_ot_shape_glyphs_closure (hb_font_t          *font,
   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 689766c1..9e0c11e1 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -175,15 +175,6 @@ struct hb_set_t
     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 d33e525d..e2c78822 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -45,7 +45,8 @@ hb_set_create (void)
   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 @@ hb_set_destroy (hb_set_t *set)
 {
   if (!hb_object_destroy (set)) return;
 
-  set->fini ();
+  set->page_map.finish ();
+  set->pages.finish ();
 
   free (set);
 }


More information about the HarfBuzz mailing list