Performance

- It it not necessary to make a copy of all configuration variable names, if the
  Config::const_iterator is sufficient.

(cherry picked from commit 5708cb90780f1f6c8f58f5b549796c4af612b1ab)
This commit is contained in:
Paul Beckingham
2013-05-26 11:40:18 -04:00
parent c16a735040
commit 7b89bc92e1
10 changed files with 95 additions and 128 deletions

View File

@@ -69,27 +69,24 @@ int CmdColor::execute (std::string& output)
{
out << "\n" << STRING_CMD_COLOR_HERE << "\n";
std::vector <std::string> all;
context.config.all (all);
ViewText view;
view.width (context.getWidth ());
view.add (Column::factory ("string", STRING_CMD_COLOR_COLOR));
view.add (Column::factory ("string", STRING_CMD_COLOR_DEFINITION));
std::vector <std::string>::iterator item;
for (item = all.begin (); item != all.end (); ++item)
Config::const_iterator item;
for (item = context.config.begin (); item != context.config.end (); ++item)
{
// Skip items with 'color' in their name, that are not referring to
// actual colors.
if (*item != "_forcecolor" &&
*item != "color" &&
item->find ("color") == 0)
if (item->first != "_forcecolor" &&
item->first != "color" &&
item->first.find ("color") == 0)
{
Color color (context.config.get (*item));
Color color (context.config.get (item->first));
int row = view.addRow ();
view.set (row, 0, *item, color);
view.set (row, 1, context.config.get (*item), color);
view.set (row, 0, item->first, color);
view.set (row, 1, item->second, color);
}
}