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
This commit is contained in:
Vadim Zeitlin 2011-05-20 14:29:07 +00:00
parent 1d8340b956
commit 9ed406c39d

View File

@ -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;
}