]> git.saurik.com Git - wxWidgets.git/commitdiff
Avoid conversion from wxString to wxChar* and back in wxListBase::DoCopy().
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 20 May 2011 14:29:07 +0000 (14:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 20 May 2011 14:29:07 +0000 (14:29 +0000)
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

index 8049c945fbdb97b776ac2554ddc22c9bfd608b7a..01fb9664bb76020e32abc7f3681d788e16336a41 100644 (file)
@@ -171,22 +171,18 @@ void wxListBase::DoCopy(const wxListBase& list)
     {
         case wxKEY_INTEGER:
             {
     {
         case wxKEY_INTEGER:
             {
-                long key;
                 for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
                 {
                 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:
             {
                 }
                 break;
             }
 
         case wxKEY_STRING:
             {
-                const wxChar *key;
                 for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
                 {
                 for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
                 {
-                    key = node->GetKeyString();
-                    Append(key, node->GetData());
+                    Append(node->GetKeyString(), node->GetData());
                 }
                 break;
             }
                 }
                 break;
             }