diff options
author | Tsuda Kageyu <tsuda.kageyu@gmail.com> | 2015-08-07 02:10:56 +0900 |
---|---|---|
committer | Tsuda Kageyu <tsuda.kageyu@gmail.com> | 2015-08-07 02:10:56 +0900 |
commit | edbafdbd88f4d8243433c30c4a8ca81706b27b70 (patch) | |
tree | ee950d49acb7c214716295add1af8ff832bb3471 | |
parent | 98ac8ba569e9206795af9548be341ca3c6fb745a (diff) |
Remove some redundant code from trefcounter.cpp.
-rw-r--r-- | taglib/toolkit/trefcounter.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/taglib/toolkit/trefcounter.cpp b/taglib/toolkit/trefcounter.cpp index 71f3c2f2..27d17b83 100644 --- a/taglib/toolkit/trefcounter.cpp +++ b/taglib/toolkit/trefcounter.cpp @@ -69,20 +69,18 @@ namespace TagLib { + class RefCounter::RefCounterPrivate { public: - RefCounterPrivate() : refCount(1) {} - - void ref() { ATOMIC_INC(refCount); } - bool deref() { return (ATOMIC_DEC(refCount) == 0); } - int count() const { return refCount; } + RefCounterPrivate() : + refCount(1) {} volatile ATOMIC_INT refCount; }; - RefCounter::RefCounter() - : d(new RefCounterPrivate()) + RefCounter::RefCounter() : + d(new RefCounterPrivate()) { } @@ -91,18 +89,18 @@ namespace TagLib delete d; } - void RefCounter::ref() - { - d->ref(); + void RefCounter::ref() + { + ATOMIC_INC(d->refCount); } - bool RefCounter::deref() - { - return d->deref(); + bool RefCounter::deref() + { + return (ATOMIC_DEC(d->refCount) == 0); } - int RefCounter::count() const - { - return d->count(); + int RefCounter::count() const + { + return static_cast<int>(d->refCount); } } |