← Back to team overview

kicad-developers team mailing list archive

[PATCH 1/5] Clarify ERC: we're iterating netlist items, not nets

 

This renames the "net", "lastNet" and "nextNet" variables to "item",
"lastItem" and "nextItem", respectively, because these refer to netlist
items, not nets.
---
 eeschema/dialogs/dialog_erc.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 1c17aaf..37c521c 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -492,8 +492,8 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
     // Reset the connection type indicator
     objectsConnectedList->ResetConnectionsType();
 
-    unsigned lastNet;
-    unsigned nextNet = lastNet = 0;
+    unsigned lastItem;
+    unsigned nextItem = lastItem = 0;
     int MinConn    = NOC;
 
     /* The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
@@ -505,17 +505,17 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
      * pass.
      */
 
-    for( unsigned net = 0; net < objectsConnectedList->size(); net++ )
+    for( unsigned item = 0; item < objectsConnectedList->size(); item++ )
     {
-        if( objectsConnectedList->GetItemNet( lastNet ) !=
-            objectsConnectedList->GetItemNet( net ) )
+        if( objectsConnectedList->GetItemNet( lastItem ) !=
+            objectsConnectedList->GetItemNet( item ) )
         {
             // New net found:
             MinConn    = NOC;
-            nextNet   = net;
+            nextItem   = item;
         }
 
-        switch( objectsConnectedList->GetItemType( net ) )
+        switch( objectsConnectedList->GetItemType( item ) )
         {
         // These items do not create erc problems
         case NET_ITEM_UNSPECIFIED:
@@ -535,11 +535,11 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
             // ERC problems when pin sheets do not match hierarchical labels.
             // Each pin sheet must match a hierarchical label
             // Each hierarchical label must match a pin sheet
-            objectsConnectedList->TestforNonOrphanLabel( net, nextNet );
+            objectsConnectedList->TestforNonOrphanLabel( item, nextItem );
             break;
         case NET_GLOBLABEL:
             if( m_tstUniqueGlobalLabels )
-                objectsConnectedList->TestforNonOrphanLabel( net, nextNet );
+                objectsConnectedList->TestforNonOrphanLabel( item, nextItem );
             break;
 
         case NET_NOCONNECT:
@@ -547,19 +547,19 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
             // ERC problems when a noconnect symbol is connected to more than one pin.
             MinConn = NET_NC;
 
-            if( objectsConnectedList->CountPinsInNet( nextNet ) > 1 )
-                Diagnose( objectsConnectedList->GetItem( net ), NULL, MinConn, UNC );
+            if( objectsConnectedList->CountPinsInNet( nextItem ) > 1 )
+                Diagnose( objectsConnectedList->GetItem( item ), NULL, MinConn, UNC );
 
             break;
 
         case NET_PIN:
 
             // Look for ERC problems between pins:
-            TestOthersItems( objectsConnectedList.get(), net, nextNet, &MinConn );
+            TestOthersItems( objectsConnectedList.get(), item, nextItem, &MinConn );
             break;
         }
 
-        lastNet = net;
+        lastItem = item;
     }
 
     // Test similar labels (i;e. labels which are identical when

Follow ups

References