Permalink
Browse files

shave a whole bunch of replace_all calls & resulting allocations

  • Loading branch information...
1 parent e19a1ce commit 83b746fd1d94c8742d8bd87a44beb44c154230c7 @ahupowerdns ahupowerdns committed Jan 15, 2015
Showing with 5 additions and 3 deletions.
  1. +5 −3 pdns/dnsparser.cc
View
@@ -531,9 +531,11 @@ string simpleCompress(const string& elabel, const string& root)
{
string label=elabel;
// FIXME: this relies on the semi-canonical escaped output from getLabelFromContent
- boost::replace_all(label, "\\.", ".");
- boost::replace_all(label, "\\032", " ");
- boost::replace_all(label, "\\\\", "\\");
+ if(strchr(label.c_str(), '\\')) {
+ boost::replace_all(label, "\\.", ".");
+ boost::replace_all(label, "\\032", " ");
+ boost::replace_all(label, "\\\\", "\\");
+ }
typedef vector<pair<unsigned int, unsigned int> > parts_t;
parts_t parts;
vstringtok(parts, label, ".");

0 comments on commit 83b746f

Please sign in to comment.