[atomic-ptr] Rename get
This commit is contained in:
parent
d3f2287e0b
commit
86d1e22d4f
|
@ -180,11 +180,11 @@ struct hb_atomic_ptr_t
|
||||||
void init (T* v_ = nullptr) { set_relaxed (v_); }
|
void init (T* v_ = nullptr) { set_relaxed (v_); }
|
||||||
void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, 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_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_); }
|
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 (); }
|
T * operator -> () const { return get_acquire (); }
|
||||||
template <typename C> operator C * () const { return get (); }
|
template <typename C> operator C * () const { return get_acquire (); }
|
||||||
|
|
||||||
T *v = nullptr;
|
T *v = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -176,12 +176,12 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
|
||||||
|
|
||||||
void init0 () {} /* Init, when memory is already set to 0. No-op for us. */
|
void init0 () {} /* Init, when memory is already set to 0. No-op for us. */
|
||||||
void init () { instance.set_relaxed (nullptr); }
|
void init () { instance.set_relaxed (nullptr); }
|
||||||
void fini () { do_destroy (instance.get ()); init (); }
|
void fini () { do_destroy (instance.get_acquire ()); init (); }
|
||||||
|
|
||||||
void free_instance ()
|
void free_instance ()
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
Stored *p = instance.get ();
|
Stored *p = instance.get_acquire ();
|
||||||
if (unlikely (p && !cmpexch (p, nullptr)))
|
if (unlikely (p && !cmpexch (p, nullptr)))
|
||||||
goto retry;
|
goto retry;
|
||||||
do_destroy (p);
|
do_destroy (p);
|
||||||
|
@ -203,7 +203,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
|
||||||
Stored * get_stored () const
|
Stored * get_stored () const
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
Stored *p = this->instance.get ();
|
Stored *p = this->instance.get_acquire ();
|
||||||
if (unlikely (!p))
|
if (unlikely (!p))
|
||||||
{
|
{
|
||||||
if (unlikely (this->is_inert ()))
|
if (unlikely (this->is_inert ()))
|
||||||
|
|
|
@ -281,7 +281,7 @@ template <typename Type>
|
||||||
static inline void hb_object_fini (Type *obj)
|
static inline void hb_object_fini (Type *obj)
|
||||||
{
|
{
|
||||||
obj->header.ref_count.fini (); /* Do this before user_data */
|
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)
|
if (user_data)
|
||||||
{
|
{
|
||||||
user_data->fini ();
|
user_data->fini ();
|
||||||
|
@ -301,7 +301,7 @@ static inline bool hb_object_set_user_data (Type *obj,
|
||||||
assert (hb_object_is_valid (obj));
|
assert (hb_object_is_valid (obj));
|
||||||
|
|
||||||
retry:
|
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))
|
if (unlikely (!user_data))
|
||||||
{
|
{
|
||||||
user_data = (hb_user_data_array_t *) hb_calloc (sizeof (hb_user_data_array_t), 1);
|
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 ()))
|
if (unlikely (!obj || obj->header.is_inert ()))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
assert (hb_object_is_valid (obj));
|
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)
|
if (!user_data)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return user_data->get (key);
|
return user_data->get (key);
|
||||||
|
|
|
@ -1379,7 +1379,7 @@ struct cff1
|
||||||
if (unlikely (!len)) return false;
|
if (unlikely (!len)) return false;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
hb_sorted_vector_t<gname_t> *names = glyph_names.get ();
|
hb_sorted_vector_t<gname_t> *names = glyph_names.get_acquire ();
|
||||||
if (unlikely (!names))
|
if (unlikely (!names))
|
||||||
{
|
{
|
||||||
names = (hb_sorted_vector_t<gname_t> *) hb_calloc (sizeof (hb_sorted_vector_t<gname_t>), 1);
|
names = (hb_sorted_vector_t<gname_t> *) hb_calloc (sizeof (hb_sorted_vector_t<gname_t>), 1);
|
||||||
|
|
|
@ -165,7 +165,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
|
||||||
if (use_cache)
|
if (use_cache)
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
cache = ot_font->advance_cache.get ();
|
cache = ot_font->advance_cache.get_acquire ();
|
||||||
if (unlikely (!cache))
|
if (unlikely (!cache))
|
||||||
{
|
{
|
||||||
cache = (hb_advance_cache_t *) hb_malloc (sizeof (hb_advance_cache_t));
|
cache = (hb_advance_cache_t *) hb_malloc (sizeof (hb_advance_cache_t));
|
||||||
|
|
|
@ -133,7 +133,7 @@ struct post
|
||||||
}
|
}
|
||||||
~accelerator_t ()
|
~accelerator_t ()
|
||||||
{
|
{
|
||||||
hb_free (gids_sorted_by_name.get ());
|
hb_free (gids_sorted_by_name.get_acquire ());
|
||||||
table.destroy ();
|
table.destroy ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ struct post
|
||||||
if (unlikely (!len)) return false;
|
if (unlikely (!len)) return false;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
uint16_t *gids = gids_sorted_by_name.get ();
|
uint16_t *gids = gids_sorted_by_name.get_acquire ();
|
||||||
|
|
||||||
if (unlikely (!gids))
|
if (unlikely (!gids))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue