]> granicus.if.org Git - taglib/commitdiff
Remove some redundant code from trefcounter.cpp.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 6 Aug 2015 17:10:56 +0000 (02:10 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 6 Aug 2015 17:10:56 +0000 (02:10 +0900)
taglib/toolkit/trefcounter.cpp

index 71f3c2f283c6ceacf5e8394f0a5623e0a61e7f61..27d17b8346e7a32f6dfbc52626e6acf76290211c 100644 (file)
 
 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);
   }
 }