From 24229eb13268a422efffbcb28a094b726824c7f0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 21 Apr 2011 16:55:17 -0400 Subject: [PATCH] Remove obsolete comment Talking to Ryan Lortie, he thinks my comment doesn't make sense. So I'm making the getter const. Note that g_atomic_int_get() casts that away itself, so we don't need to worry about that (which kinda makes me uncomfortable actually). --- src/hb-object-private.hh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh index 74bc3ad..0a055e9 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; -- 2.7.4