From 86d1e22d4f3ee27aa803230490188b8a05097437 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 3 Aug 2022 12:43:28 -0600 Subject: [PATCH] [atomic-ptr] Rename get --- src/hb-atomic.hh | 6 +++--- src/hb-machinery.hh | 6 +++--- src/hb-object.hh | 6 +++--- src/hb-ot-cff1-table.hh | 2 +- src/hb-ot-font.cc | 2 +- src/hb-ot-post-table.hh | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index 4f20c3c89..ebed242b2 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -180,11 +180,11 @@ struct hb_atomic_ptr_t void init (T* v_ = nullptr) { set_relaxed (v_); } void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, v_); } T *get_relaxed () const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); } - T *get () const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); } + T *get_acquire () const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); } bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); } - T * operator -> () const { return get (); } - template operator C * () const { return get (); } + T * operator -> () const { return get_acquire (); } + template operator C * () const { return get_acquire (); } T *v = nullptr; }; diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index ff2a99f5e..2571f22e1 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -176,12 +176,12 @@ struct hb_lazy_loader_t : hb_data_wrapper_t void init0 () {} /* Init, when memory is already set to 0. No-op for us. */ void init () { instance.set_relaxed (nullptr); } - void fini () { do_destroy (instance.get ()); init (); } + void fini () { do_destroy (instance.get_acquire ()); init (); } void free_instance () { retry: - Stored *p = instance.get (); + Stored *p = instance.get_acquire (); if (unlikely (p && !cmpexch (p, nullptr))) goto retry; do_destroy (p); @@ -203,7 +203,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t Stored * get_stored () const { retry: - Stored *p = this->instance.get (); + Stored *p = this->instance.get_acquire (); if (unlikely (!p)) { if (unlikely (this->is_inert ())) diff --git a/src/hb-object.hh b/src/hb-object.hh index f6c7a5699..aed3b12c8 100644 --- a/src/hb-object.hh +++ b/src/hb-object.hh @@ -281,7 +281,7 @@ template static inline void hb_object_fini (Type *obj) { obj->header.ref_count.fini (); /* Do this before user_data */ - hb_user_data_array_t *user_data = obj->header.user_data.get (); + hb_user_data_array_t *user_data = obj->header.user_data.get_acquire (); if (user_data) { user_data->fini (); @@ -301,7 +301,7 @@ static inline bool hb_object_set_user_data (Type *obj, assert (hb_object_is_valid (obj)); retry: - hb_user_data_array_t *user_data = obj->header.user_data.get (); + hb_user_data_array_t *user_data = obj->header.user_data.get_acquire (); if (unlikely (!user_data)) { user_data = (hb_user_data_array_t *) hb_calloc (sizeof (hb_user_data_array_t), 1); @@ -326,7 +326,7 @@ static inline void *hb_object_get_user_data (Type *obj, if (unlikely (!obj || obj->header.is_inert ())) return nullptr; assert (hb_object_is_valid (obj)); - hb_user_data_array_t *user_data = obj->header.user_data.get (); + hb_user_data_array_t *user_data = obj->header.user_data.get_acquire (); if (!user_data) return nullptr; return user_data->get (key); diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index 4aa337f78..17b029661 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -1379,7 +1379,7 @@ struct cff1 if (unlikely (!len)) return false; retry: - hb_sorted_vector_t *names = glyph_names.get (); + hb_sorted_vector_t *names = glyph_names.get_acquire (); if (unlikely (!names)) { names = (hb_sorted_vector_t *) hb_calloc (sizeof (hb_sorted_vector_t), 1); diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index a3420775c..ef28c7d65 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -165,7 +165,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, if (use_cache) { retry: - cache = ot_font->advance_cache.get (); + cache = ot_font->advance_cache.get_acquire (); if (unlikely (!cache)) { cache = (hb_advance_cache_t *) hb_malloc (sizeof (hb_advance_cache_t)); diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index a4c0c4aa1..f9cfd7f16 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -133,7 +133,7 @@ struct post } ~accelerator_t () { - hb_free (gids_sorted_by_name.get ()); + hb_free (gids_sorted_by_name.get_acquire ()); table.destroy (); } @@ -160,7 +160,7 @@ struct post if (unlikely (!len)) return false; retry: - uint16_t *gids = gids_sorted_by_name.get (); + uint16_t *gids = gids_sorted_by_name.get_acquire (); if (unlikely (!gids)) {