[object] Simplify reference_count_t

pull/2874/head
Behdad Esfahbod 4 years ago
parent 4d116ed0f0
commit 2ec802b42a
  1. 8
      src/hb-object.hh

@ -140,9 +140,7 @@ struct hb_lockable_set_t
* Reference-count.
*/
#define HB_REFERENCE_COUNT_INERT_VALUE 0
#define HB_REFERENCE_COUNT_POISON_VALUE -0x0000DEAD
#define HB_REFERENCE_COUNT_INIT {HB_ATOMIC_INT_INIT (HB_REFERENCE_COUNT_INERT_VALUE)}
#define HB_REFERENCE_COUNT_INIT {HB_ATOMIC_INT_INIT (0)}
struct hb_reference_count_t
{
@ -152,9 +150,9 @@ struct hb_reference_count_t
int get_relaxed () const { return ref_count.get_relaxed (); }
int inc () const { return ref_count.inc (); }
int dec () const { return ref_count.dec (); }
void fini () { ref_count.set_relaxed (HB_REFERENCE_COUNT_POISON_VALUE); }
void fini () { ref_count.set_relaxed (-0x0000DEAD); }
bool is_inert () const { return ref_count.get_relaxed () == HB_REFERENCE_COUNT_INERT_VALUE; }
bool is_inert () const { return !ref_count.get_relaxed (); }
bool is_valid () const { return ref_count.get_relaxed () > 0; }
};

Loading…
Cancel
Save