[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/4] Use std::string::substr instead of appending single chars



Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
---
 src/abg-ini.cc | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/abg-ini.cc b/src/abg-ini.cc
index 7558c2f..8320e1f 100644
--- a/src/abg-ini.cc
+++ b/src/abg-ini.cc
@@ -176,8 +176,6 @@ char_is_white_space(int b)
 static string
 trim_white_space(const string& str)
 {
-  string result;
-
   if (str.empty())
     return str;
 
@@ -191,10 +189,7 @@ trim_white_space(const string& str)
     if (!char_is_white_space(str[e]))
       break;
 
-  for (unsigned i = s; i <= e; ++i)
-    result += str[i];
-
-  return result;
+  return str.substr(s, e - s + 1);
 }
 
 // <property stuff>
-- 
2.13.6