for_each_*_object: take flag arguments as enum
authorJeff King <peff@peff.net>
Fri, 10 Aug 2018 23:09:44 +0000 (19:09 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Aug 2018 20:48:25 +0000 (13:48 -0700)
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>
cache.h
packfile.c
packfile.h
sha1-file.c
diff --git a/cache.h b/cache.h
index 4187238ecf36e22d796ed030bfb72db975a0c164..9e02fc494ea1a0b4c1c9f3ad4e55ceb500d2086e 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1640,7 +1640,8 @@ enum for_each_object_flags {
  * repository and any alternates repositories (unless the
  * LOCAL_ONLY flag is set).
  */
-extern int for_each_loose_object(each_loose_object_fn, void *, unsigned flags);
+int for_each_loose_object(each_loose_object_fn, void *,
+                         enum for_each_object_flags flags);
 
 /*
  * Set this to 0 to prevent sha1_object_info_extended() from fetching missing
index 6974903e581ae4517979ec083da844bde3034c8f..9da8f6d728b3377b60d37123ebc066b79ba3ea14 100644 (file)
@@ -1904,7 +1904,8 @@ int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn cb, void
        return r;
 }
 
-int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)
+int for_each_packed_object(each_packed_object_fn cb, void *data,
+                          enum for_each_object_flags flags)
 {
        struct packed_git *p;
        int r = 0;
index 6ddc6a2e9163a30e7b8c1b91e159be9c0bd477b6..9861728514b2735375c9d4080a809d3ecaff1f40 100644 (file)
@@ -158,8 +158,9 @@ typedef int each_packed_object_fn(const struct object_id *oid,
                                  struct packed_git *pack,
                                  uint32_t pos,
                                  void *data);
-extern int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn, void *data);
-extern int for_each_packed_object(each_packed_object_fn, void *, unsigned flags);
+int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn, void *data);
+int for_each_packed_object(each_packed_object_fn, void *,
+                          enum for_each_object_flags flags);
 
 /*
  * Return 1 if an object in a promisor packfile is or refers to the given
index dfa8a35d68d9b40d4fa30cff15c1f027a201192e..cc0b57a751bd35082003350e8f6b282aa1a955ef 100644 (file)
@@ -2146,7 +2146,8 @@ static int loose_from_alt_odb(struct alternate_object_database *alt,
        return r;
 }
 
-int for_each_loose_object(each_loose_object_fn cb, void *data, unsigned flags)
+int for_each_loose_object(each_loose_object_fn cb, void *data,
+                         enum for_each_object_flags flags)
 {
        struct loose_alt_odb_data alt;
        int r;