Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-05-16 17:53:27 +0300
committerJunio C Hamano <gitster@pobox.com>2022-05-17 03:28:02 +0300
commit8a50571a0ea700fe2b9a3c7ef7ed2117c87ca9ba (patch)
treebb0575812d2f0ff53dc342690b9e6f1474d305de /object-file.c
parent7c898554d7a80e5d70ee8816a23dc425d2f1729c (diff)
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>
Diffstat (limited to 'object-file.c')
-rw-r--r--object-file.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/object-file.c b/object-file.c
index b5d1d12b68..52e4ae1b5f 100644
--- a/object-file.c
+++ b/object-file.c
@@ -2623,12 +2623,8 @@ int read_loose_object(const char *path,
goto out;
}
- switch (unpack_loose_header(&stream, map, mapsize, hdr, sizeof(hdr),
- NULL)) {
- case ULHR_OK:
- break;
- case ULHR_BAD:
- case ULHR_TOO_LONG:
+ if (unpack_loose_header(&stream, map, mapsize, hdr, sizeof(hdr),
+ NULL) != ULHR_OK) {
error(_("unable to unpack header of %s"), path);
goto out;
}