atomicobject / heatshrink

data compression library for embedded/real-time systems
ISC License
1.31k stars 176 forks source link

Fallthrough in usage should be `break` #65

Open BenBE opened 3 years ago

BenBE commented 3 years ago

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

https://github.com/atomicobject/heatshrink/blob/ffd95059ff9155fa373b3e6276854db3ad7b4e3c/src/heatshrink.c#L410-L412

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.