diff options
| author | Lioncash <mathew1800@gmail.com> | 2017-03-21 17:51:22 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2017-03-21 18:12:40 -0400 |
| commit | 2f52d04e3044accf0656a32c2090e625e3f76c8b (patch) | |
| tree | f04ea5bcdaa18316ff10aa05706afa465bc9587e /Source | |
| parent | 0d0e9f626d1a1f5323d91062d4b4c360f78dd99b (diff) | |
GeckoCodeConfig: Use compare instead of substr for comparing substrings
Gets rid of an unnecessary string construction.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/GeckoCodeConfig.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp index 70d65705ba..8cae3d8b68 100644 --- a/Source/Core/Core/GeckoCodeConfig.cpp +++ b/Source/Core/Core/GeckoCodeConfig.cpp @@ -79,14 +79,15 @@ std::vector<GeckoCode> LoadCodes(const IniFile& globalIni, const IniFile& localI for (const std::string& line : lines) { - if (line.size() == 0 || line[0] != '$') + if (line.empty() || line[0] != '$') { continue; } - std::string name = line.substr(1); + for (GeckoCode& ogcode : gcodes) { - if (ogcode.name == name) + // Exclude the initial '$' from the comparison. + if (line.compare(1, std::string::npos, ogcode.name) == 0) { ogcode.enabled = true; } |
