diff options
author | Eugene Sandulenko | 2006-06-02 17:51:20 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-06-02 17:51:20 +0000 |
commit | 05871836b9cb9851a09cd98258f5cbc75f30344a (patch) | |
tree | a602c2d58c585b6cb091ad188142f1e4675f9662 /gui/theme-config.cpp | |
parent | 180f6c87ad5e85ee5c822c0dfeb4f1637581540e (diff) | |
download | scummvm-rg350-05871836b9cb9851a09cd98258f5cbc75f30344a.tar.gz scummvm-rg350-05871836b9cb9851a09cd98258f5cbc75f30344a.tar.bz2 scummvm-rg350-05871836b9cb9851a09cd98258f5cbc75f30344a.zip |
Turn AliasesMap and VariablesMap keys from String to const char *.
Stats before:
Strings: 12048
mallocs: 55629
after:
Strings: 6370
mallocs: 42117
Here Strings are non-empty strings. Mallocs are string-related mallocs
including mallocs in HashMap BaseNode.
svn-id: r22841
Diffstat (limited to 'gui/theme-config.cpp')
-rw-r--r-- | gui/theme-config.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index baa44992fb..fbc0575f89 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -424,13 +424,13 @@ void Theme::processSingleLine(const String §ion, const String prefix, const to += postfixes[i]; _evaluator->setAlias(selfpostfixes[i], to); - _evaluator->setVar(to, EVAL_UNDEF_VAR); + _evaluator->setVar(to.c_str(), EVAL_UNDEF_VAR); } for (i = 0; i < str.size(); i++) { if (isspace(str[i]) && level == 0) { value = _evaluator->eval(String(&(str.c_str()[start]), i - start), section, name + postfixes[npostfix], start); - _evaluator->setVar(prefixedname + postfixes[npostfix++], value); + _evaluator->setVar((prefixedname + postfixes[npostfix++]).c_str(), value); start = i + 1; } if (str[i] == '(') @@ -453,15 +453,15 @@ void Theme::processSingleLine(const String §ion, const String prefix, const // process VAR=VALUE construct if (npostfix == 0) - _evaluator->setVar(name, value); + _evaluator->setVar(name.c_str(), value); else - _evaluator->setVar(prefixedname + postfixes[npostfix], value); + _evaluator->setVar((prefixedname + postfixes[npostfix]).c_str(), value); // If we have all 4 parameters, set .x2 and .y2 if (npostfix == 3) { - _evaluator->setVar(prefixedname + ".x2", + _evaluator->setVar((prefixedname + ".x2").c_str(), _evaluator->getVar(prefixedname + ".x") + _evaluator->getVar(prefixedname + ".w")); - _evaluator->setVar(prefixedname + ".y2", + _evaluator->setVar((prefixedname + ".y2").c_str(), _evaluator->getVar(prefixedname + ".y") + _evaluator->getVar(prefixedname + ".h")); } @@ -482,12 +482,12 @@ void Theme::processResSection(Common::ConfigFile &config, String name, bool skip continue; } if (iterk->key.hasPrefix("set_")) { - _evaluator->setAlias(name, iterk->key, prefix + iterk->value); + _evaluator->setAlias(name, iterk->key.c_str(), prefix + iterk->value); continue; } if (iterk->key.hasPrefix("def_")) { if (!skipDefs) - _evaluator->setVar(name, prefix + iterk->key, iterk->value); + _evaluator->setVar(name, (prefix + iterk->key).c_str(), iterk->value); continue; } if (iterk->key == "use") { @@ -529,16 +529,16 @@ void Theme::processResSection(Common::ConfigFile &config, String name, bool skip } void Theme::setSpecialAlias(const String alias, const String &name) { - const char *postfixes[] = {"x", "y", "w", "h", "x2", "y2"}; + const char *postfixes[] = {".x", ".y", ".w", ".h", ".x2", ".y2"}; int i; for (i = 0; i < ARRAYSIZE(postfixes); i++) { String from, to; - from = alias + "." + postfixes[i]; - to = name + "." + postfixes[i]; + from = alias + postfixes[i]; + to = name + postfixes[i]; - _evaluator->setAlias(from, to); + _evaluator->setAlias(from.c_str(), to); } } |