From 76116f36dd946ee49863a356f03eac8a05f22dcb Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 3 Jun 2006 13:33:39 +0000 Subject: *Loads* of Common::String related optimizations. Woa, *tons* of methods were copying strings needlessly svn-id: r22873 --- gui/theme-config.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'gui/theme-config.cpp') diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index fbc0575f89..2e69d6da1b 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -407,7 +407,7 @@ const char *Theme::_defaultConfigINI = using Common::String; -void Theme::processSingleLine(const String §ion, const String prefix, const String name, const String str) { +void Theme::processSingleLine(const String §ion, const String &prefix, const String &name, const String &str) { int level = 0; int start = 0; uint i; @@ -470,7 +470,7 @@ void Theme::processSingleLine(const String §ion, const String prefix, const } -void Theme::processResSection(Common::ConfigFile &config, String name, bool skipDefs, const String prefix) { +void Theme::processResSection(Common::ConfigFile &config, const String &name, bool skipDefs, const String &prefix) { debug(3, "Reading section: [%s]", name.c_str()); const Common::ConfigFile::SectionKeyList &keys = config.getKeys(name); @@ -509,13 +509,12 @@ void Theme::processResSection(Common::ConfigFile &config, String name, bool skip if (iterk->key == "useWithPrefix") { const char *temp = iterk->value.c_str(); const char *pos = strrchr(temp, ' '); - String n, pref; if (pos == NULL) error("2 arguments required for useWithPrefix keyword"); - n = String(temp, strchr(temp, ' ') - temp); - pref = String(pos + 1); + String n(temp, strchr(temp, ' ') - temp); + String pref(pos + 1); if (n == name) error("Theme section [%s]: cannot use itself", n.c_str()); @@ -528,15 +527,13 @@ void Theme::processResSection(Common::ConfigFile &config, String name, bool skip } } -void Theme::setSpecialAlias(const String alias, const String &name) { +void Theme::setSpecialAlias(const String &alias, const String &name) { 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]; + String from(alias + postfixes[i]); + String to(name + postfixes[i]); _evaluator->setAlias(from.c_str(), to); } -- cgit v1.2.3