From 2805f34f3995e5f7e315a49cf3c459467f3a88f4 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Thu, 20 Dec 2018 20:50:33 +0530 Subject: [PATCH] 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 --- src/mon/MonCap.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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) { -- 2.47.3