Author: mordante
Date: Sun Mar 13 19:59:25 2011
New Revision: 48893

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48893&view=rev
Log:
Avoid returning a pointer to a temporary.

Issue found by cppcheck.

Modified:
    trunk/src/formatter.hpp
    trunk/src/gui/widgets/debug.cpp

Modified: trunk/src/formatter.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formatter.hpp?rev=48893&r1=48892&r2=48893&view=diff
==============================================================================
--- trunk/src/formatter.hpp (original)
+++ trunk/src/formatter.hpp Sun Mar 13 19:59:25 2011
@@ -48,10 +48,6 @@
                return stream_.str();
        }
 
-       const char* c_str() {
-               return str().c_str();
-       }
-
 private:
        std::ostringstream stream_;
 };

Modified: trunk/src/gui/widgets/debug.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/debug.cpp?rev=48893&r1=48892&r2=48893&view=diff
==============================================================================
--- trunk/src/gui/widgets/debug.cpp (original)
+++ trunk/src/gui/widgets/debug.cpp Sun Mar 13 19:59:25 2011
@@ -89,7 +89,7 @@
        static unsigned counter = 0;
        ++counter;
 
-       return (formatter() << buf << '_' << counter << '_').c_str();
+       return (formatter() << buf << '_' << counter << '_').str();
 }
        /***** ***** ***** ***** FLAGS ***** ***** ***** *****/
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to