diff options
| author | Jeff King <peff@peff.net> | 2025-02-25 01:33:51 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-25 10:25:49 -0800 |
| commit | 547f719d9b022e87eb8cf3cb7a7632822b996e29 (patch) | |
| tree | 9eb31d774fd24b2c3f163e4e73f5cf2eff5c2a75 /compat/regex/regex_internal.c | |
| parent | 84b5c1a099e6df35f4b54d651b425a894513e62b (diff) | |
unpack_loose_rest(): simplify error handling
Inflating a loose object is considered successful only if we got
Z_STREAM_END and there were no more bytes. We check both of those
conditions and return success, but then have to check them a second time
to decide which error message to produce.
I.e., we do something like this:
if (!error_1 && !error_2)
...return success...
if (error_1)
...handle error1...
else if (error_2)
...handle error2...
...common error handling...
This repetition was the source of a small bug fixed in an earlier commit
(our Z_STREAM_END check was not the same in the two conditionals).
Instead we can chain them all into a single if/else cascade, which
avoids repeating ourselves:
if (error_1)
...handle error1...
else if (error_2)
...handle error2....
else
...return success...
...common error handling...
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/regex/regex_internal.c')
0 files changed, 0 insertions, 0 deletions
