]> git.ipfire.org Git - thirdparty/git.git/commit
object-file: convert 'switch' back to 'if'
authorDerrick Stolee <derrickstolee@github.com>
Mon, 16 May 2022 14:53:27 +0000 (10:53 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 May 2022 00:28:02 +0000 (17:28 -0700)
commit8a50571a0ea700fe2b9a3c7ef7ed2117c87ca9ba
treebb0575812d2f0ff53dc342690b9e6f1474d305de
parent7c898554d7a80e5d70ee8816a23dc425d2f1729c
object-file: convert 'switch' back to 'if'

This switch statement was recently added to make it clear that
unpack_loose_header() returns an enum value, not an int. This adds
complications for future developers if that enum gains new values, since
that developer would need to add a case statement to this switch for
little real value.

Instead, we can revert back to an 'if' statement, but make the enum
explicit by using "!= ULHR_OK" instead of assuming it has the numerical
value zero.

Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-file.c