diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index e8c9491817..ccb89c2889 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -863,15 +863,8 @@ void CONNECTION_GRAPH::removeSubgraphs( std::set& aSubgrap ++it; } - for( auto it = m_item_to_subgraph_map.begin(); it != m_item_to_subgraph_map.end(); ) - { - if( it->second == sg ) - it = m_item_to_subgraph_map.erase( it ); - else - ++it; - } - - + for( auto it : sg->GetItems() ) + m_item_to_subgraph_map.erase( it ); } for( auto it = m_net_name_to_code_map.begin(); it != m_net_name_to_code_map.end(); ) diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index d9ad097948..80c6ccf7f9 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -1045,6 +1045,7 @@ void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aBodyStyle ) const LIB_SYMBOL_SPTR parent = m_parent.lock(); const LIB_ITEMS_CONTAINER& drawItems = parent ? parent->m_drawings : m_drawings; + aList.reserve( drawItems.size( LIB_PIN_T ) ); for( const LIB_ITEM& item : drawItems[LIB_PIN_T] ) { diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 1155d3f5a0..2d07b99139 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -182,14 +182,15 @@ public: bool IsStrokeEquivalent( const SCH_LINE* aLine ) { - if( m_stroke.GetWidth() != aLine->GetStroke().GetWidth() ) + const STROKE_PARAMS other_stroke = aLine->GetStroke(); + if( m_stroke.GetWidth() != other_stroke.GetWidth() ) return false; - if( m_stroke.GetColor() != aLine->GetStroke().GetColor() ) + if( m_stroke.GetColor() != other_stroke.GetColor() ) return false; LINE_STYLE style_a = m_stroke.GetLineStyle(); - LINE_STYLE style_b = aLine->GetStroke().GetLineStyle(); + LINE_STYLE style_b = other_stroke.GetLineStyle(); return style_a == style_b || ( style_a == LINE_STYLE::DEFAULT && style_b == LINE_STYLE::SOLID ) diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index b07fa7e294..fd8acc1426 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2040,6 +2040,7 @@ bool SCH_SYMBOL::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) c void SCH_SYMBOL::GetEndPoints( std::vector & aItemList ) { + aItemList.reserve( m_pins.size() ); for( auto& pin : m_pins ) { LIB_PIN* lib_pin = pin->GetLibPin(); @@ -2047,8 +2048,7 @@ void SCH_SYMBOL::GetEndPoints( std::vector & aItemList ) if( lib_pin && lib_pin->GetUnit() && m_unit && ( m_unit != lib_pin->GetUnit() ) ) continue; - DANGLING_END_ITEM item( PIN_END, lib_pin, GetPinPhysicalPosition( lib_pin ), this ); - aItemList.push_back( item ); + aItemList.emplace_back( PIN_END, lib_pin, GetPinPhysicalPosition( lib_pin ), this ); } }