mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Remove some redundant code from trefcounter.cpp.
This commit is contained in:
parent
98ac8ba569
commit
edbafdbd88
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user