]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck.h: use "enum object_type" instead of "int"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sun, 28 Mar 2021 13:15:35 +0000 (15:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Mar 2021 02:03:10 +0000 (19:03 -0700)
Change the fsck_walk_func to use an "enum object_type" instead of an
"int" type. The types are compatible, and ever since this was added in
355885d5315 (add generic, type aware object chain walker, 2008-02-25)
we've used entries from object_type (OBJ_BLOB etc.).

So this doesn't really change anything as far as the generated code is
concerned, it just gives the compiler more information and makes this
easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c
builtin/index-pack.c
builtin/unpack-objects.c
fsck.h

index a56a2d0513a5cb5be75c7c25e707cfa343a465cb..ed5f2af6b5c386cfaca229551a698294ca571f1f 100644 (file)
@@ -192,7 +192,8 @@ static int traverse_reachable(void)
        return !!result;
 }
 
-static int mark_used(struct object *obj, int type, void *data, struct fsck_options *options)
+static int mark_used(struct object *obj, enum object_type object_type,
+                    void *data, struct fsck_options *options)
 {
        if (!obj)
                return 1;
index bad57488079c7f7ec715f9efd935e255c871e8f1..69f24fe9f7655f9fd725a274d983e1e03d380f97 100644 (file)
@@ -212,7 +212,8 @@ static void cleanup_thread(void)
        free(thread_data);
 }
 
-static int mark_link(struct object *obj, int type, void *data, struct fsck_options *options)
+static int mark_link(struct object *obj, enum object_type type,
+                    void *data, struct fsck_options *options)
 {
        if (!obj)
                return -1;
index dd4a75e030d219dfb3e5e0eeb59683c14f02fdf0..ca54fd16688f6979a465f24297b83075d41c0d59 100644 (file)
@@ -187,7 +187,8 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
  * that have reachability requirements and calls this function.
  * Verify its reachability and validity recursively and write it out.
  */
-static int check_object(struct object *obj, int type, void *data, struct fsck_options *options)
+static int check_object(struct object *obj, enum object_type type,
+                       void *data, struct fsck_options *options)
 {
        struct obj_buffer *obj_buf;
 
diff --git a/fsck.h b/fsck.h
index 73e8b9f3e4ef3b9efdf153931aa974e76de3012b..f20f1259e844b937de910943fd2f96d4c2b4718f 100644 (file)
--- a/fsck.h
+++ b/fsck.h
@@ -23,7 +23,8 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type);
  *     <0      error signaled and abort
  *     >0      error signaled and do not abort
  */
-typedef int (*fsck_walk_func)(struct object *obj, int type, void *data, struct fsck_options *options);
+typedef int (*fsck_walk_func)(struct object *obj, enum object_type object_type,
+                             void *data, struct fsck_options *options);
 
 /* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
 typedef int (*fsck_error)(struct fsck_options *o,