diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-08-14 23:58:28 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-08-14 23:58:28 +0000 |
commit | 6af38938c1752bf61b8855db1f1524d0e9ed6097 (patch) | |
tree | 06d78158db2546416bbfd6f990f7f5c1264d3fa1 /Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh | |
parent | a54d196b0fc4715e3d2dbcfe62cfccea6aae57fe (diff) |
harfbuzz 1.8.8
git-svn-id: svn://tug.org/texlive/trunk@48403 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh')
-rw-r--r-- | Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh index 457cd957bfb..fb04bbc3cf5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh @@ -56,7 +56,7 @@ _hb_shapers_get (void); #define HB_SHAPER_DATA_TYPE_NAME(shaper, object) hb_##shaper##_##object##_data_t #define HB_SHAPER_DATA_TYPE(shaper, object) struct HB_SHAPER_DATA_TYPE_NAME(shaper, object) -#define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* (HB_SHAPER_DATA_TYPE(shaper, object) **) &(instance)->shaper_data.shaper) +#define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* reinterpret_cast<hb_atomic_ptr_t<HB_SHAPER_DATA_TYPE(shaper, object) *> *> (&(instance)->shaper_data.shaper)) #define HB_SHAPER_DATA(shaper, object) HB_SHAPER_DATA_INSTANCE(shaper, object, object) #define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_create #define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_destroy @@ -72,7 +72,7 @@ _hb_shapers_get (void); HB_SHAPER_DATA_ENSURE_FUNC (shaper, object) (hb_##object##_t *object) #define HB_SHAPER_DATA_DESTROY(shaper, object) \ - if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object)) \ + if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object).get ()) \ if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \ HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); @@ -84,9 +84,10 @@ bool \ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \ {\ retry: \ - HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, object) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \ + HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object).get (); \ if (likely (data) && !(condition)) { \ - /* Note that evaluating condition above can be dangerous if another thread \ + /* XXX-MT-bug \ + * Note that evaluating condition above can be dangerous if another thread \ * got here first and destructed data. That's, as always, bad use pattern. \ * If you modify the font (change font size), other threads must not be \ * using it at the same time. However, since this check is delayed to \ @@ -99,7 +100,8 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \ /* Drop and recreate. */ \ /* If someone dropped it in the mean time, throw it away and don't touch it. \ * Otherwise, destruct it. */ \ - if (hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), data, nullptr)) { \ + if (likely (HB_SHAPER_DATA (shaper, object).cmpexch (data, nullptr))) \ + { \ HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \ } \ goto retry; \ @@ -108,7 +110,7 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \ data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \ if (unlikely (!data)) \ data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \ - if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), nullptr, data)) { \ + if (unlikely (!HB_SHAPER_DATA (shaper, object).cmpexch (nullptr, data))) { \ if (data && \ data != HB_SHAPER_DATA_INVALID && \ data != HB_SHAPER_DATA_SUCCEEDED) \ @@ -122,7 +124,7 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \ /* For embedding in face / font / ... */ struct hb_shaper_data_t { -#define HB_SHAPER_IMPLEMENT(shaper) void *shaper; +#define HB_SHAPER_IMPLEMENT(shaper) hb_atomic_ptr_t<void *> shaper; #include "hb-shaper-list.hh" #undef HB_SHAPER_IMPLEMENT }; |