mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Performance
- Moved DOM stack variable instantiation to immediately before first use, which is after more common use cases.
This commit is contained in:
parent
a801ec2f50
commit
b7d7646c28
1 changed files with 5 additions and 7 deletions
12
src/DOM.cpp
12
src/DOM.cpp
|
@ -162,13 +162,6 @@ const std::string DOM::get (const std::string& name)
|
|||
//
|
||||
const std::string DOM::get (const std::string& name, const Task& task)
|
||||
{
|
||||
Nibbler n (name);
|
||||
n.save ();
|
||||
|
||||
int id;
|
||||
std::string uuid;
|
||||
std::string canonical;
|
||||
|
||||
// <attr>
|
||||
if (task.size () && name == "id")
|
||||
return format (task.id);
|
||||
|
@ -176,10 +169,14 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||
if (task.size () && name == "urgency")
|
||||
return format (task.urgency_c ());
|
||||
|
||||
std::string canonical;
|
||||
if (task.size () && context.a3t.canonicalize (canonical, "attribute", name))
|
||||
return task.get (canonical);
|
||||
|
||||
// <id>.<name>
|
||||
Nibbler n (name);
|
||||
n.save ();
|
||||
int id;
|
||||
if (n.getInt (id))
|
||||
{
|
||||
if (n.skip ('.'))
|
||||
|
@ -202,6 +199,7 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||
}
|
||||
|
||||
// <uuid>.<name>
|
||||
std::string uuid;
|
||||
if (n.getUUID (uuid))
|
||||
{
|
||||
if (n.skip ('.'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue