- Removed unneeded NULL checks.
- Other code tweaks and cleanups.
This commit is contained in:
spx
2011-11-08 10:32:57 +00:00
parent 10f7504b86
commit a209bf15d0
17 changed files with 242 additions and 258 deletions

View File

@ -207,7 +207,8 @@ bool CMeasure::MakePlainSubstitute(std::wstring& str, size_t index)
str.replace(pos, m_Substitute[index].first.length(), m_Substitute[index].second);
start = pos + m_Substitute[index].second.length();
}
} while (pos != std::wstring::npos);
}
while (pos != std::wstring::npos);
return true;
}
@ -313,7 +314,8 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
utf8str.replace(start, length, result);
offset = start + result.length();
}
} while (true);
}
while (true);
// Release memory used for the compiled pattern
pcre_free(re);
@ -343,7 +345,7 @@ bool CMeasure::ParseSubstitute(std::wstring buffer)
{
if (buffer.empty()) return true;
while (!buffer.empty())
do
{
std::wstring word1 = ExtractWord(buffer);
std::wstring sep = ExtractWord(buffer);
@ -358,6 +360,7 @@ bool CMeasure::ParseSubstitute(std::wstring buffer)
sep = ExtractWord(buffer);
if (!sep.empty() && sep != L",") return false;
}
while (!buffer.empty());
return true;
}
@ -772,11 +775,7 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, cons
{
// Comparison is caseinsensitive
if (*measure == L'\0')
{
return NULL;
}
else if (_wcsicmp(L"CPU", measure) == 0)
if (_wcsicmp(L"CPU", measure) == 0)
{
return new CMeasureCPU(meterWindow, name);
}