Skip to contentSkip to conversation

drivers/isdn/divert: beautify code, delete useless 'break'

PATCH In review Chen Gang 3 participants 5 messages Apr 1, 2013 – Apr 2, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 drivers/isdn/divert: beautify code, delete useless 'break'

delete useless break statements.

---
 drivers/isdn/divert/isdn_divert.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/isdn/divert/isdn_divert.c +0 -2
index db432e6..76d505e 100644
@@ -442,7 +442,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
 		switch (dv->rule.action) {
 		case DEFLECT_IGNORE:
 			return (0);
-			break;
 
 		case DEFLECT_ALERT:
 		case DEFLECT_PROCEED:
@@ -511,7 +510,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
 
 		default:
 			return (0); /* ignore call */
-			break;
 		} /* switch action */
 		break;
 	} /* scan_table */
Signature · 1 line
1.7.7.6
#1 lore raw

Hello.

Quoted 20 lines · Chen Gang

delete useless break statements.

---
  drivers/isdn/divert/isdn_divert.c |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
drivers/isdn/divert/isdn_divert.c +0 -1
index db432e6..76d505e 100644
@@ -442,7 +442,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
  		switch (dv->rule.action) {
  		case DEFLECT_IGNORE:
  			return (0);
-			break;
 
  		case DEFLECT_ALERT:
  		case DEFLECT_PROCEED:

drivers/isdn/divert/isdn_divert.c static int isdn_divert_icall(isdn_ctrl *ic) · line 514

Quoted 4 lines
drivers/isdn/divert/isdn_divert.c +0 -1
@@ -511,7 +510,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
 
  		default:
  			return (0); /* ignore call */
-			break;

You could have removed stupid () around 0, while at it.

WBR, Sergei

author
#2 lore raw
Quoted 16 lines · Sergei Shtylyov
Quoted 16 lines
drivers/isdn/divert/isdn_divert.c +0 -1
index db432e6..76d505e 100644
@@ -442,7 +442,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
          switch (dv->rule.action) {
          case DEFLECT_IGNORE:
              return (0);
-            break;
 
          case DEFLECT_ALERT:
          case DEFLECT_PROCEED:
@@ -511,7 +510,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
 
Quoted 5 lines

drivers/isdn/divert/isdn_divert.c static int isdn_divert_icall(isdn_ctrl *ic) · line 514

Quoted 3 lines
drivers/isdn/divert/isdn_divert.c +0 -1
          default:
              return (0); /* ignore call */
-            break;

You could have removed stupid () around 0, while at it.

oh, really, I should do it.

I will send patch v2 for it

thanks.

:-)

Signature · 3 lines
Chen Gang

Asianux Corporation
author
#3 lore raw

PATCH 1/1 ISDN:divert: beautify code: useless 'break', 'return (0)', additional comments.

In reply to Sergei Shtylyov

delete useless 'break' after 'return'.
let 'return 0' instead of 'return (0)'
also give a comment for 'break' to let readers notice it.

---
 drivers/isdn/divert/isdn_divert.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/isdn/divert/isdn_divert.c +3 -5
index db432e6..50749a7 100644
@@ -441,8 +441,7 @@ static int isdn_divert_icall(isdn_ctrl *ic)
 
 		switch (dv->rule.action) {
 		case DEFLECT_IGNORE:
-			return (0);
-			break;
+			return 0;
 
 		case DEFLECT_ALERT:
 		case DEFLECT_PROCEED:
@@ -510,10 +509,9 @@ static int isdn_divert_icall(isdn_ctrl *ic)
 			break;
 
 		default:
-			return (0); /* ignore call */
-			break;
+			return 0; /* ignore call */
 		} /* switch action */
-		break;
+		break; /* will break the 'for' looping */
 	} /* scan_table */
 
 	if (cs) {
Signature · 1 line
1.7.7.6