mirror of https://github.com/stella-emu/stella.git
Minor optimization in settings file parsing; don't copy a few strings.
This commit is contained in:
parent
72f6096ba8
commit
404ab8ffcc
|
@ -221,10 +221,8 @@ void Settings::loadConfig()
|
|||
continue;
|
||||
|
||||
// Split the line into key/value pairs and trim any whitespace
|
||||
key = line.substr(0, equalPos);
|
||||
value = line.substr(equalPos + 1, line.length() - key.length() - 1);
|
||||
key = trim(key);
|
||||
value = trim(value);
|
||||
key = trim(line.substr(0, equalPos));
|
||||
value = trim(line.substr(equalPos + 1, line.length() - key.length() - 1));
|
||||
|
||||
// Skip absent key
|
||||
if(key.length() == 0)
|
||||
|
|
|
@ -98,7 +98,7 @@ class Settings
|
|||
virtual void saveConfig();
|
||||
|
||||
// Trim leading and following whitespace from a string
|
||||
static string trim(string& str)
|
||||
static string trim(const string& str)
|
||||
{
|
||||
string::size_type first = str.find_first_not_of(' ');
|
||||
return (first == string::npos) ? EmptyString :
|
||||
|
|
Loading…
Reference in New Issue