From b79d2d925844cb14c809996c6315c9d2487c4e58 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 21 Jul 2019 16:35:22 -0600 Subject: [PATCH] Cleanup. --- pcbnew/router/pns_kicad_iface.cpp | 11 +++-------- pcbnew/router/pns_node.cpp | 25 ++++++++++--------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 8578e4ca16..0646678100 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -46,20 +45,15 @@ #include #include #include -#include #include "tools/pcb_tool_base.h" #include "pns_kicad_iface.h" - #include "../../include/geometry/shape_simple.h" #include "pns_routing_settings.h" -#include "pns_sizes_settings.h" #include "pns_item.h" #include "pns_solid.h" #include "pns_segment.h" -#include "pns_solid.h" -#include "pns_itemset.h" #include "pns_node.h" #include "pns_topology.h" #include "pns_router.h" @@ -88,7 +82,7 @@ private: }; int localPadClearance( const PNS::ITEM* aItem ) const; - int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName ); + int matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, wxString& aBaseDpName ); PNS::ROUTER* m_router; BOARD* m_board; @@ -212,7 +206,8 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( int aNetCode ) const } -int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName ) +int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, + wxString& aBaseDpName ) { int rv = 0; diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index 28ebbe3e1f..5f5587e0d7 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -25,9 +25,7 @@ #include #include -#include #include -#include #include "pns_item.h" #include "pns_line.h" @@ -36,7 +34,6 @@ #include "pns_solid.h" #include "pns_joint.h" #include "pns_index.h" -#include "pns_router.h" namespace PNS { @@ -83,10 +80,10 @@ NODE::~NODE() m_joints.clear(); - for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) + for( ITEM* item : *m_index ) { - if( (*i)->BelongsTo( this ) ) - delete *i; + if( item->BelongsTo( this ) ) + delete item; } releaseGarbage(); @@ -118,15 +115,14 @@ NODE* NODE::Branch() child->m_root = isRoot() ? this : m_root; child->m_maxClearance = m_maxClearance; - // immmediate offspring of the root branch needs not copy anything. - // For the rest, deep-copy joints, overridden item map and pointers - // to stored items. + // Immmediate offspring of the root branch needs not copy anything. For the rest, deep-copy + // joints, overridden item maps and pointers to stored items. if( !isRoot() ) { JOINT_MAP::iterator j; - for( INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i ) - child->m_index->Add( *i ); + for( ITEM* item : *m_index ) + child->m_index->Add( item ); child->m_joints = m_joints; child->m_override = m_override; @@ -154,7 +150,6 @@ OBSTACLE_VISITOR::OBSTACLE_VISITOR( const ITEM* aItem ) : m_override( NULL ), m_extraClearance( 0 ) { - } @@ -301,7 +296,7 @@ int NODE::QueryColliding( const ITEM* aItem, NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, - const std::set* aRestrictedSet ) + const std::set* aRestrictedSet ) { OBSTACLES obs_list; bool found_isects = false; @@ -330,9 +325,9 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aItem, int aKindMask, nearest.m_item = NULL; nearest.m_distFirst = INT_MAX; - for( OBSTACLE obs : obs_list ) + for( const OBSTACLE& obs : obs_list ) { - VECTOR2I ip_first, ip_last; + VECTOR2I ip_last; int dist_max = INT_MIN; if( aRestrictedSet && aRestrictedSet->find( obs.m_item ) == aRestrictedSet->end() )