From 44c2782d39ba7f8881e7966def56bf8ab50ec991 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Sun, 25 Sep 2022 00:45:59 +0100 Subject: [PATCH] Fix more for loops making copies of iterates --- eeschema/dialogs/dialog_migrate_buses.cpp | 2 +- eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp | 2 +- eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp | 2 +- eeschema/symbol_library_manager.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/dialog_migrate_buses.cpp b/eeschema/dialogs/dialog_migrate_buses.cpp index c2b4eead16..47da63ca01 100644 --- a/eeschema/dialogs/dialog_migrate_buses.cpp +++ b/eeschema/dialogs/dialog_migrate_buses.cpp @@ -105,7 +105,7 @@ void DIALOG_MIGRATE_BUSES::updateUi() m_migration_list->InsertColumn( 2, _( "New Label" ) ); m_migration_list->InsertColumn( 3, _( "Status" ) ); - for( auto item : m_items ) + for( auto& item : m_items ) { wxString old = item.labels[0]; for( unsigned j = 1; j < item.labels.size(); j++ ) diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index 21da6a1490..662956077c 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -767,7 +767,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) { const SCH_SYMBOL* origSymbol = cmp.second.cmp; - for( auto unitEntry : cmp.second.units ) + for( auto& unitEntry : cmp.second.units ) { if( unitEntry.second == false ) continue; // unit has been already processed diff --git a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp index f8eb73f84b..0223f4a057 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_lib_plugin_cache.cpp @@ -1377,7 +1377,7 @@ void SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& if( aMap ) { - for( auto entry : *aMap ) + for( auto& entry : *aMap ) { LIB_SYMBOL* symbol = entry.second; diff --git a/eeschema/symbol_library_manager.cpp b/eeschema/symbol_library_manager.cpp index e9d7f12030..5d409110c3 100644 --- a/eeschema/symbol_library_manager.cpp +++ b/eeschema/symbol_library_manager.cpp @@ -1029,7 +1029,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( std::shared_ptrSaveSymbol( m_libName, parentSymbol ); - for( auto entry : derivedSymbols ) + for( auto& entry : derivedSymbols ) { std::shared_ptr symbol = GetBuffer( entry );