From: Jos Collin Date: Thu, 20 Dec 2018 15:20:33 +0000 (+0530) Subject: mon: avoid str copy in parse X-Git-Tag: v14.1.0~530^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25640%2Fhead;p=ceph.git mon: avoid str copy in parse Avoids the input string copy. It doesn't make any difference when the input string is copied. Signed-off-by: Jos Collin --- diff --git a/src/mon/MonCap.cc b/src/mon/MonCap.cc index c1d7c7123003..29d81d44ac67 100644 --- a/src/mon/MonCap.cc +++ b/src/mon/MonCap.cc @@ -601,14 +601,11 @@ struct MonCapParser : qi::grammar bool MonCap::parse(const string& str, ostream *err) { - string s = str; - string::iterator iter = s.begin(); - string::iterator end = s.end(); - - MonCapParser g; - bool r = qi::parse(iter, end, g, *this); - //MonCapGrant foo; - //bool r = qi::phrase_parse(iter, end, g, ascii::space, foo); + auto iter = str.begin(); + auto end = str.end(); + + MonCapParser exp; + bool r = qi::parse(iter, end, exp, *this); if (r && iter == end) { text = str; for (auto& g : grants) {