diff options
| author | Patrick Steinhardt <ps@pks.im> | 2026-02-12 07:59:40 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-02-12 11:05:08 -0800 |
| commit | f6516a5241684355f3fb9f7b70e287e98b48d0ef (patch) | |
| tree | c047f41fc243eae618dadb37fb609dfc68120d0e /object-file.c | |
| parent | ae77afc3478c87766c4db9082fa82195d6ce9560 (diff) | |
| download | git-f6516a5241684355f3fb9f7b70e287e98b48d0ef.tar.xz | |
odb: convert object info flags into an enum
Convert the object info flags into an enum and adapt all functions that
receive these flags as parameters to use the enum instead of an integer.
This serves two purposes:
- The function signatures become more self-documenting, as callers
don't have to wonder which flags they expect.
- The compiler can warn when a wrong flag type is passed.
Note that the second benefit is somewhat limited. For example, when
or-ing multiple enum flags together the result will be an integer, and
the compiler will not warn about such use cases. But where it does help
is when a single flag of the wrong type is passed, as the compiler would
generate a warning in that case.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-file.c')
| -rw-r--r-- | object-file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/object-file.c b/object-file.c index e7e4c3348f..0ab6c4d4f3 100644 --- a/object-file.c +++ b/object-file.c @@ -414,7 +414,8 @@ static int parse_loose_header(const char *hdr, struct object_info *oi) int odb_source_loose_read_object_info(struct odb_source *source, const struct object_id *oid, - struct object_info *oi, int flags) + struct object_info *oi, + enum object_info_flags flags) { int ret; int fd; |
