summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorAdrian Wielgosik <adrian.wielgosik@gmail.com>2016-02-02 23:15:25 +0100
committerAdrian Wielgosik <adrian.wielgosik@gmail.com>2016-02-03 15:54:10 +0100
commit732510fef9af5addc5e3ff1a79ce8c9658711fb6 (patch)
treeed2bbadc78fe1296bdd9b19c3ff39bf66fab0eff /apt-pkg/contrib
parent4f649ab9c5ec882b434477552e20f46826fc388f (diff)
Avoid temporary strings in SubstVar.
Microoptimization, but still gives a measurable 2-3% improvement when using commands with lots of output like `apt list`.
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/strutl.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 5e641a02b..242a78449 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -464,7 +464,9 @@ string SubstVar(const string &Str,const string &Subst,const string &Contents)
if (OldPos >= Str.length())
return Temp;
- return Temp + string(Str,OldPos);
+
+ Temp.append(Str, OldPos, string::npos);
+ return Temp;
}
string SubstVar(string Str,const struct SubstVar *Vars)
{