Skip to content

Commit 56f56ac

Browse files
avargitster
authored andcommitted
style: do not "break" in switch() after "return"
Remove this unreachable code. It was found by SunCC, it's found by a non-fatal warning emitted by SunCC. It's one of the things it's more vehement about than GCC & Clang. It complains about a lot of other similarly unreachable code, e.g. a BUG(...) without a "return", and a "return 0" after a long if/else, both of whom have "return" statements. Those are also genuine redundancies to a compiler, but arguably make the code a bit easier to read & less fragile to maintain. These return/break cases are just unnecessary however, and as seen here the surrounding code just did a plain "return" without a "break" already. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 898f807 commit 56f56ac

File tree

2 files changed

+0
-3
lines changed

2 files changed

+0
-3
lines changed

apply.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3948,10 +3948,8 @@ static int check_patch(struct apply_state *state, struct patch *patch)
39483948
break; /* happy */
39493949
case EXISTS_IN_INDEX:
39503950
return error(_("%s: already exists in index"), new_name);
3951-
break;
39523951
case EXISTS_IN_INDEX_AS_ITA:
39533952
return error(_("%s: does not match index"), new_name);
3954-
break;
39553953
case EXISTS_IN_WORKTREE:
39563954
return error(_("%s: already exists in working directory"),
39573955
new_name);

builtin/fast-export.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,6 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
923923
if (!tag)
924924
die("Tag %s points nowhere?", e->name);
925925
return (struct commit *)tag;
926-
break;
927926
}
928927
default:
929928
return NULL;

0 commit comments

Comments
 (0)