diff options
author | Adrian Wielgosik <adrian.wielgosik@gmail.com> | 2016-02-02 23:15:25 +0100 |
---|---|---|
committer | Adrian Wielgosik <adrian.wielgosik@gmail.com> | 2016-02-03 15:54:10 +0100 |
commit | 732510fef9af5addc5e3ff1a79ce8c9658711fb6 (patch) | |
tree | ed2bbadc78fe1296bdd9b19c3ff39bf66fab0eff | |
parent | 4f649ab9c5ec882b434477552e20f46826fc388f (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`.
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 4 |
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) { |