diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh index 74bc3ad5a..0a055e924 100644 --- a/src/hb-object-private.hh +++ b/src/hb-object-private.hh @@ -46,20 +46,8 @@ typedef struct { inline int dec (void) { return hb_atomic_int_fetch_and_add (ref_count, -1); } inline void set (int v) { return hb_atomic_int_set (ref_count, v); } - /* XXX - * - * One thing I'm not sure. The following two methods should be declared - * const. However, that assumes that hb_atomic_int_get() is const. I have - * a vague memory hearing from Chris Wilson or Jeff Muizelaar that atomic get - * is implemented as a fetch_and_add(0). In which case it does write to the - * memory, and hence cannot be called on .rodata section. But that's how we - * use it. - * - * If that is indeed the case, then perhaps is_invalid() should do a - * non-protected read of the location. - */ - inline int get (void) { return hb_atomic_int_get (ref_count); } - inline bool is_invalid (void) { return get () == HB_REFERENCE_COUNT_INVALID_VALUE; } + inline int get (void) const { return hb_atomic_int_get (ref_count); } + inline bool is_invalid (void) const { return get () == HB_REFERENCE_COUNT_INVALID_VALUE; } } hb_reference_count_t;