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>
Jeff King committed
Aug 10, 2018 at 19:09 UTC
a7ff6f5a0f310406aa4973e8d7ec25815554bcb5
4 files changed
+9
-5
cache.h
+2
-1
@@ -1640,7 +1640,8 @@ enum for_each_object_flags {
1640
* repository and any alternates repositories (unless the
1641
* LOCAL_ONLY flag is set).
1642
*/
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);
1645
1646
/*
1647
* Set this to 0 to prevent sha1_object_info_extended() from fetching missing
packfile.c
+2
-1
@@ -1904,7 +1904,8 @@ int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn cb, void
1904
return r;
1905
}
1906
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)
1909
{
1910
struct packed_git *p;
1911
int r = 0;
packfile.h
+3
-2
@@ -158,8 +158,9 @@ typedef int each_packed_object_fn(const struct object_id *oid,
158
struct packed_git *pack,
159
uint32_t pos,
160
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);
164
165
/*
166
* Return 1 if an object in a promisor packfile is or refers to the given
sha1-file.c
+2
-1
@@ -2146,7 +2146,8 @@ static int loose_from_alt_odb(struct alternate_object_database *alt,
2146
return r;
2147
}
2148
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)
2151
{
2152
struct loose_alt_odb_data alt;
2153
int r;