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>
This commit is contained in:
parent
7c898554d7
commit
8a50571a0e
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user