mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
Performance: Removed unnecessary std::string::substr in high-traffic code
This commit is contained in:
parent
25b7f42810
commit
b5c4bf0a6d
4 changed files with 37 additions and 39 deletions
|
@ -73,7 +73,7 @@ bool DOM::get (const std::string& name, Variant& value)
|
|||
|
||||
// rc. --> context.config
|
||||
if (len > 3 &&
|
||||
name.substr (0, 3) == "rc.")
|
||||
! name.compare (0, 3, "rc.", 3))
|
||||
{
|
||||
std::string key = name.substr (3);
|
||||
auto c = context.config.find (key);
|
||||
|
@ -88,7 +88,7 @@ bool DOM::get (const std::string& name, Variant& value)
|
|||
|
||||
// context.*
|
||||
if (len > 8 &&
|
||||
name.substr (0, 8) == "context.")
|
||||
! name.compare (0, 8, "context.", 8))
|
||||
{
|
||||
if (name == "context.program")
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ bool DOM::get (const std::string& name, Variant& value)
|
|||
|
||||
// system. --> Implement locally.
|
||||
if (len > 7 &&
|
||||
name.substr (0, 7) == "system.")
|
||||
! name.compare (0, 7, "system.", 7))
|
||||
{
|
||||
// Taskwarrior version number.
|
||||
if (name == "system.version")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue