mail[Wesnoth-commits] r40387 - /trunk/src/help.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on December 25, 2009 - 10:48:
Author: silene
Date: Fri Dec 25 10:48:55 2009
New Revision: 40387

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40387&view=rev
Log:
Factored code.

Modified:
    trunk/src/help.cpp

Modified: trunk/src/help.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/help.cpp?rev=40387&r1=40386&r2=40387&view=diff
==============================================================================
--- trunk/src/help.cpp (original)
+++ trunk/src/help.cpp Fri Dec 25 10:48:55 2009
@@ -571,7 +571,10 @@
 static std::string remove_first_space(const std::string& text);
 
 /// Prepend all chars with meaning inside attributes with a backslash.
-static std::string escape(const std::string &s);
+static std::string escape(const std::string &s)
+{
+       return utils::escape(s, "'\\");
+}
 
 /// Return the first word in s, not removing any spaces in the start of
 /// it.
@@ -3057,22 +3060,6 @@
        return text;
 }
 
-std::string escape(const std::string &s)
-{
-       std::string res = s;
-       if(!res.empty()) {
-               std::string::size_type pos = 0;
-               do {
-                       pos = res.find_first_of("'\\", pos);
-                       if(pos != std::string::npos) {
-                               res.insert(pos, 1, '\\');
-                               pos += 2;
-                       }
-               } while(pos < res.size() && pos != std::string::npos);
-       }
-       return res;
-}
-
 std::string get_first_word(const std::string &s)
 {
        size_t first_word_start = s.find_first_not_of(' ');




Related Messages


Powered by MHonArc, Updated Fri Dec 25 11:00:12 2009