From 9ed406c39de65f24da3a3210a7651e7ee6cf1923 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 20 May 2011 14:29:07 +0000 Subject: [PATCH] Avoid conversion from wxString to wxChar* and back in wxListBase::DoCopy(). Don't use temporary wxChar* variable to store the node string. This is not only inefficient because we need to convert wxString to it only to convert it back to wxString on the next line but also breaks compilation when wxUSE_STD_STRING==1 and wxUSE_STD_CONTAINERS==0 as there is no implicit conversion between wxString and wxChar* in this case. Also modify the code for long keys in the same way just for consistency. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67769 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/list.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/common/list.cpp b/src/common/list.cpp index 8049c945fb..01fb9664bb 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -171,22 +171,18 @@ void wxListBase::DoCopy(const wxListBase& list) { case wxKEY_INTEGER: { - long key; for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) { - key = node->GetKeyInteger(); - Append(key, node->GetData()); + Append(node->GetKeyInteger(), node->GetData()); } break; } case wxKEY_STRING: { - const wxChar *key; for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() ) { - key = node->GetKeyString(); - Append(key, node->GetData()); + Append(node->GetKeyString(), node->GetData()); } break; }