lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master bad9fa53 1/5: Prefer standard library to wx s


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bad9fa53 1/5: Prefer standard library to wx string functions
Date: Tue, 14 Feb 2023 19:30:36 -0500 (EST)

branch: master
commit bad9fa53f608159cca02800db4db7b372ee9caee
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Prefer standard library to wx string functions
    
    There's no need to make a wxString copy of this std::string.
---
 main_wx_test.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index 92dfd116..ca529dcd 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -44,7 +44,7 @@
 #include <wx/uiaction.h>
 #include <wx/wfstream.h>
 
-#include <algorithm>                    // sort()
+#include <algorithm>                    // replace(), sort()
 #include <cstring>                      // strcmp()
 #include <exception>                    // uncaught_exceptions()
 #include <iostream>
@@ -497,13 +497,12 @@ TestsResults application_test::run()
                 // Keep everything on a single line to ensure the full text of
                 // the error appears if the output is filtered by the test name
                 // using standard line-oriented tools such as grep.
-                wxString one_line_error(error);
-                one_line_error.Replace("\n", " ");
+                std::replace(error.begin(), error.end(), '\n', ' ');
 
                 std::cout
                     << name
                     << ": ERROR ("
-                    << one_line_error
+                    << error
                     << ")"
                     << std::endl
                     ;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]