2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 17:04:55 +00:00

Function-scope statics aren't as efficient as file-scope ones

This commit is contained in:
Jack Andersen
2016-04-14 17:24:51 -10:00
parent 1404f84480
commit 037404c5ff
3 changed files with 8 additions and 9 deletions

View File

@@ -20,6 +20,7 @@ namespace hecl
{
unsigned VerbosityLevel = 0;
logvisor::Module LogModule("hecl");
static const std::string Illegals {"<>?*\"|"};
void SanitizePath(std::string& path)
{
@@ -31,8 +32,7 @@ void SanitizePath(std::string& path)
bool ic = false;
std::transform(path.begin(), path.end(), path.begin(), [&](const char a) -> char {
++p1;
static const std::string illegals {"<>?*\"|"};
if (illegals.find_first_of(a) != std::string::npos)
if (Illegals.find_first_of(a) != std::string::npos)
{
ic = false;
return '_';
@@ -52,6 +52,8 @@ void SanitizePath(std::string& path)
});
}
static const std::wstring WIllegals {L"<>?*\"|"};
void SanitizePath(std::wstring& path)
{
if (path.empty())
@@ -62,8 +64,7 @@ void SanitizePath(std::wstring& path)
bool ic = false;
std::transform(path.begin(), path.end(), path.begin(), [&](const wchar_t a) -> wchar_t {
++p1;
static const std::wstring illegals {L"<>?*\"|"};
if (illegals.find_first_of(a) != std::wstring::npos)
if (WIllegals.find_first_of(a) != std::wstring::npos)
{
ic = false;
return L'_';