From 3e3aaa33db71f9e808a516e676a2317ae87fb51a Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 5 Jun 2015 22:47:28 +0200 Subject: [PATCH] Refactor string manipulations in wxPropertyGrid::ExpandEscapeSequence and CreateEscapeSequences. Share wxString::clear() method to initialize empty destination string. --- src/propgrid/propgrid.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index f99267e4d8..fba42329db 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1736,18 +1736,17 @@ wxPoint wxPropertyGrid::GetGoodEditorDialogPosition( wxPGProperty* p, wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& src_str ) { + dst_str.clear(); + if ( src_str.empty() ) { - dst_str = src_str; - return src_str; + return dst_str; } bool prev_is_slash = false; wxString::const_iterator i = src_str.begin(); - dst_str.clear(); - for ( ; i != src_str.end(); ++i ) { wxUniChar a = *i; @@ -1795,17 +1794,16 @@ wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& sr wxString& wxPropertyGrid::CreateEscapeSequences( wxString& dst_str, wxString& src_str ) { + dst_str.clear(); + if ( src_str.empty() ) { - dst_str = src_str; - return src_str; + return dst_str; } wxString::const_iterator i = src_str.begin(); wxUniChar prev_a = wxS('\0'); - dst_str.clear(); - for ( ; i != src_str.end(); ++i ) { wxChar a = *i;