Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallthrough in usage should be break #65

Open
BenBE opened this issue May 20, 2021 · 0 comments
Open

Fallthrough in usage should be break #65

BenBE opened this issue May 20, 2021 · 0 comments
Labels
Milestone

Comments

@BenBE
Copy link

BenBE commented May 20, 2021

While looking through my local changes I noticed a small difference between the local changes and the upstream develop branch:

heatshrink/src/heatshrink.c

Lines 410 to 412 in ffd9505

case 'h': /* help */
usage();
/* FALLTHROUGH */

In my local version I imported the fix for #46 using a break in that place, which is IMHO the more natural choice, as you normally don't expect the usage() display to cause any side-effects on your program configuration, thus resulting in the following code locally instead:

        case 'h':               /* help */
            usage();
            break;

Given that usage() internally calls exit(1); this is even stranger, as this comment causes the expectation of the code continuing after the call to usage(); returns.

@silentbicycle silentbicycle added this to the v0.5.0 milestone May 20, 2021
@silentbicycle silentbicycle modified the milestones: v0.5.0, 0.4.2 Jun 8, 2021
silentbicycle added a commit that referenced this issue Jul 4, 2021
`usage()` should not exit itself, because the help and invalid
command line flag code paths should return a different status.

Closes #65.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants