More refactoring

This commit is contained in:
Pavel Krajcevski 2013-08-26 16:11:53 -04:00
parent 0304bd4187
commit af2318027b

View file

@ -103,7 +103,7 @@ void BlockStat::ToString(CHAR *buf, int bufSz) const {
#ifdef _MSC_VER #ifdef _MSC_VER
_sntprintf_s(buf, bufSz, _TRUNCATE, "%s,%lu", m_StatName, (unsigned long)m_IntStat); _sntprintf_s(buf, bufSz, _TRUNCATE, "%s,%lu", m_StatName, (unsigned long)m_IntStat);
#else #else
snprintf(buf, bufSz, "%s,%lu", m_StatName, (unsigned long)m_IntStat); snprintf(buf, bufSz, "%s,%lu", m_StatName, (unsigned long)m_IntStat);
#endif #endif
break; break;
@ -136,13 +136,13 @@ void BlockStatManager::Copy(const BlockStatManager &other) {
} }
BlockStatManager::BlockStatManager(const BlockStatManager &other) { BlockStatManager::BlockStatManager(const BlockStatManager &other) {
Copy(other); Copy(other);
} }
BlockStatManager &BlockStatManager::operator=(const BlockStatManager &other) { BlockStatManager &BlockStatManager::operator=(const BlockStatManager &other) {
m_Counter = other.m_Counter; m_Counter = other.m_Counter;
Copy(other); Copy(other);
return *this; return *this;
} }
BlockStatManager::BlockStatManager(int nBlocks) BlockStatManager::BlockStatManager(int nBlocks)
@ -241,12 +241,12 @@ BlockStatManager::BlockStatList::BlockStatList(const BlockStat &stat)
: m_Tail(0) : m_Tail(0)
, m_Stat(stat) , m_Stat(stat)
{ {
assert(!"If you're copying a block stat list then you're probably not using them properly."); assert(!"If you're copying a block stat list then you're probably not using them properly.");
} }
BlockStatManager::BlockStatList::BlockStatList(const BlockStatList &other) BlockStatManager::BlockStatList::BlockStatList(const BlockStatList &other)
: m_Tail(new BlockStatList(*other.m_Tail)) : m_Tail(new BlockStatList(*other.m_Tail))
, m_Stat(other.m_Stat) , m_Stat(other.m_Stat)
{} {}
BlockStatManager::BlockStatList::~BlockStatList() { BlockStatManager::BlockStatList::~BlockStatList() {
@ -256,7 +256,6 @@ BlockStatManager::BlockStatList::~BlockStatList() {
} }
void BlockStatManager::BlockStatList::AddStat(const BlockStat &stat) { void BlockStatManager::BlockStatList::AddStat(const BlockStat &stat) {
if(strncmp(stat.m_StatName, m_Stat.m_StatName, BlockStat::kStatNameSz) == 0) { if(strncmp(stat.m_StatName, m_Stat.m_StatName, BlockStat::kStatNameSz) == 0) {
m_Stat = stat; m_Stat = stat;
} }