← Back to team overview

kicad-developers team mailing list archive

[PATCH 15/16] Avoid switch with only default case

 

These switch statements only have a single "default" case, so they are unneeded.
---
 bitmap2component/bitmap2cmp_gui.cpp | 10 +---------
 pcb_calculator/pcb_calculator.cpp   | 12 +-----------
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp
index 5caa7a6..99ad647 100644
--- a/bitmap2component/bitmap2cmp_gui.cpp
+++ b/bitmap2component/bitmap2cmp_gui.cpp
@@ -672,15 +672,7 @@ static struct IFACE : public KIFACE_I
 
     wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
     {
-        switch( aClassId )
-        {
-
-        default:
-            {
-                KIWAY_PLAYER* frame = new BM2CMP_FRAME( aKiway, aParent );
-                return frame;
-            }
-        }
+        return new BM2CMP_FRAME( aKiway, aParent );
     }
 
     /**
diff --git a/pcb_calculator/pcb_calculator.cpp b/pcb_calculator/pcb_calculator.cpp
index 6a9f970..384bc8e 100644
--- a/pcb_calculator/pcb_calculator.cpp
+++ b/pcb_calculator/pcb_calculator.cpp
@@ -61,17 +61,7 @@ static struct IFACE : public KIFACE_I
 
     wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
     {
-        switch( aClassId )
-        {
-        default:
-            {
-                PCB_CALCULATOR_FRAME* frame = new PCB_CALCULATOR_FRAME( aKiway, aParent );
-                return frame;
-            }
-            break;
-        }
-
-        return NULL;
+        return new PCB_CALCULATOR_FRAME( aKiway, aParent );
     }
 
     /**

Follow ups

References