[lazy] Add .free()
authorBehdad Esfahbod <behdad@behdad.org>
Sun, 12 Aug 2018 23:00:13 +0000 (16:00 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 12 Aug 2018 23:00:13 +0000 (16:00 -0700)
src/hb-ft.cc
src/hb-glib.cc
src/hb-icu.cc
src/hb-machinery-private.hh
src/hb-ot-font.cc
src/hb-ucdn.cc

index c58cd87..5ac9a3e 100644 (file)
@@ -454,7 +454,7 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft
 static
 void free_static_ft_funcs (void)
 {
-  static_ft_funcs.fini ();
+  static_ft_funcs.free ();
 }
 #endif
 
index a5a82d4..6ce9a35 100644 (file)
@@ -394,7 +394,7 @@ static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
 static
 void free_static_glib_funcs (void)
 {
-  static_glib_funcs.fini ();
+  static_glib_funcs.free ();
 }
 #endif
 
index 99e3d2c..0442d92 100644 (file)
@@ -373,7 +373,7 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_
 static
 void free_static_icu_funcs (void)
 {
-  static_icu_funcs.fini ();
+  static_icu_funcs.free ();
 }
 #endif
 
index b26ca71..6221fe5 100644 (file)
@@ -628,6 +628,10 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
   inline void init (void) { instance.set_relaxed (nullptr); }
   inline void fini (void)
   {
+    do_destroy (instance.get ());
+  }
+  inline void free (void)
+  {
   retry:
     Stored *p = instance.get ();
     if (unlikely (p && !this->instance.cmpexch (p, nullptr)))
index 1fb18c4..f181b07 100644 (file)
@@ -264,7 +264,7 @@ static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot
 static
 void free_static_ot_funcs (void)
 {
-  static_ot_funcs.fini ();
+  static_ot_funcs.free ();
 }
 #endif
 
index c58db05..1945a1c 100644 (file)
@@ -267,7 +267,7 @@ static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
 static
 void free_static_ucdn_funcs (void)
 {
-  static_ucdn_funcs.fini ();
+  static_ucdn_funcs.free ();
 }
 #endif