Skip to content

Commit a7ff6f5

Browse files
peffgitster
authored andcommitted
for_each_*_object: take flag arguments as enum
It's not wrong to pass our flags in an "unsigned", as we know it will be at least as large as the enum. However, using the enum in the declaration makes it more obvious where to find the list of flags. While we're here, let's also drop the "extern" noise-words from the declarations, per our modern coding style. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 202e7f1 commit a7ff6f5

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

cache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,8 @@ enum for_each_object_flags {
16401640
* repository and any alternates repositories (unless the
16411641
* LOCAL_ONLY flag is set).
16421642
*/
1643-
extern int for_each_loose_object(each_loose_object_fn, void *, unsigned flags);
1643+
int for_each_loose_object(each_loose_object_fn, void *,
1644+
enum for_each_object_flags flags);
16441645

16451646
/*
16461647
* Set this to 0 to prevent sha1_object_info_extended() from fetching missing

packfile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1904,7 +1904,8 @@ int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn cb, void
19041904
return r;
19051905
}
19061906

1907-
int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)
1907+
int for_each_packed_object(each_packed_object_fn cb, void *data,
1908+
enum for_each_object_flags flags)
19081909
{
19091910
struct packed_git *p;
19101911
int r = 0;

packfile.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ typedef int each_packed_object_fn(const struct object_id *oid,
158158
struct packed_git *pack,
159159
uint32_t pos,
160160
void *data);
161-
extern int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn, void *data);
162-
extern int for_each_packed_object(each_packed_object_fn, void *, unsigned flags);
161+
int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn, void *data);
162+
int for_each_packed_object(each_packed_object_fn, void *,
163+
enum for_each_object_flags flags);
163164

164165
/*
165166
* Return 1 if an object in a promisor packfile is or refers to the given

sha1-file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2146,7 +2146,8 @@ static int loose_from_alt_odb(struct alternate_object_database *alt,
21462146
return r;
21472147
}
21482148

2149-
int for_each_loose_object(each_loose_object_fn cb, void *data, unsigned flags)
2149+
int for_each_loose_object(each_loose_object_fn cb, void *data,
2150+
enum for_each_object_flags flags)
21502151
{
21512152
struct loose_alt_odb_data alt;
21522153
int r;

0 commit comments

Comments
 (0)