mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-07 22:58:34 +02:00
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:
parent
c16a735040
commit
7b89bc92e1
10 changed files with 95 additions and 128 deletions
|
@ -105,25 +105,21 @@ void Hooks::initialize ()
|
|||
bool big_red_switch = context.config.getBoolean ("extensions");
|
||||
if (big_red_switch)
|
||||
{
|
||||
std::vector <std::string> vars;
|
||||
context.config.all (vars);
|
||||
|
||||
std::vector <std::string>::iterator it;
|
||||
for (it = vars.begin (); it != vars.end (); ++it)
|
||||
Config::const_iterator it;
|
||||
for (it = context.config.begin (); it != context.config.end (); ++it)
|
||||
{
|
||||
std::string type;
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
// "<type>.<name>"
|
||||
Nibbler n (*it);
|
||||
Nibbler n (it->first);
|
||||
if (n.getUntil ('.', type) &&
|
||||
type == "hook" &&
|
||||
n.skip ('.') &&
|
||||
n.getUntilEOS (name))
|
||||
{
|
||||
std::string value = context.config.get (*it);
|
||||
Nibbler n (value);
|
||||
Nibbler n (it->second);
|
||||
|
||||
// <path>:<function> [, ...]
|
||||
while (!n.depleted ())
|
||||
|
@ -141,7 +137,7 @@ void Hooks::initialize ()
|
|||
(void) n.skip (',');
|
||||
}
|
||||
else
|
||||
; // Was: throw std::string (format ("Malformed hook definition '{1}'.", *it));
|
||||
; // Was: throw std::string (format ("Malformed hook definition '{1}'.", it->first));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue