[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Aug 13 00:48:16 UTC 2018


 src/hb-common.cc            |   60 ++++++++++++++++++++++----------------------
 src/hb-machinery-private.hh |    2 -
 2 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit 989e71a982658145f28f83f2111bdab9561f3db0
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 12 17:47:59 2018 -0700

    Silence clang

diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh
index a179eea9..99ef485a 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery-private.hh
@@ -597,7 +597,7 @@ struct hb_data_wrapper_t
 
   inline Data * get_data (void) const
   {
-    return *(((Data **) this) - WheresData);
+    return *(((Data **) (void *) this) - WheresData);
   }
 
   template <typename Stored, typename Subclass>
commit 6750ec692cdd682bd33cb1c37b137cf3bb641d43
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Aug 12 17:42:16 2018 -0700

    [lazy] Use for C_locale

diff --git a/src/hb-common.cc b/src/hb-common.cc
index 6d12c097..22dd52f4 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -28,6 +28,7 @@
 
 #include "hb-private.hh"
 
+#include "hb-machinery-private.hh"
 
 #include <locale.h>
 #ifdef HAVE_XLOCALE_H
@@ -730,48 +731,47 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv)
 
 #ifdef USE_XLOCALE
 
-static hb_atomic_ptr_t<HB_LOCALE_T> C_locale;
 
-#ifdef HB_USE_ATEXIT
-static void
-free_C_locale (void)
-{
-retry:
-  HB_LOCALE_T locale = C_locale.get ();
+static void free_static_C_locale (void);
 
-  if (unlikely (!C_locale.cmpexch (locale, nullptr)))
-    goto retry;
-
-  if (locale)
-    HB_FREE_LOCALE (locale);
-}
-#endif
-
-static HB_LOCALE_T
-get_C_locale (void)
+static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<HB_LOCALE_T>::value,
+							  hb_C_locale_lazy_loader_t>
 {
-retry:
-  HB_LOCALE_T C = C_locale.get ();
-
-  if (unlikely (!C))
+  static inline HB_LOCALE_T create (void)
   {
-    C = HB_CREATE_LOCALE ("C");
-
-    if (unlikely (!C_locale.cmpexch (nullptr, C)))
-    {
-      HB_FREE_LOCALE (C);
-      goto retry;
-    }
+    HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C");
 
 #ifdef HB_USE_ATEXIT
-    atexit (free_C_locale); /* First person registers atexit() callback. */
+    atexit (free_static_C_locale);
 #endif
+
+    return C_locale;
+  }
+  static inline void destroy (HB_LOCALE_T p)
+  {
+    HB_FREE_LOCALE (p);
+  }
+  static inline HB_LOCALE_T get_null (void)
+  {
+    return nullptr;
   }
+} static_C_locale;
 
-  return C;
+#ifdef HB_USE_ATEXIT
+static
+void free_static_C_locale (void)
+{
+  static_C_locale.free_instance ();
 }
 #endif
 
+static HB_LOCALE_T
+get_C_locale (void)
+{
+  return static_C_locale.get_unconst ();
+}
+#endif /* USE_XLOCALE */
+
 static bool
 parse_float (const char **pp, const char *end, float *pv)
 {


More information about the HarfBuzz mailing list