fsck.h: use "enum object_type" instead of "int"

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>

Ævar Arnfjörð Bjarmason committed Mar 28, 2021 at 15:15 UTC a1aad71601a7a2052058d735ef86624b3cc774cf
4 files changed +8 -4
builtin/fsck.c
+2 -1
@@ -192,7 +192,8 @@ static int traverse_reachable(void)
192 return !!result;
193 }
194
195 -static int mark_used(struct object *obj, int type, void *data, struct fsck_options *options)
195 +static int mark_used(struct object *obj, enum object_type object_type,
196 + void *data, struct fsck_options *options)
197 {
198 if (!obj)
199 return 1;
builtin/index-pack.c
+2 -1
@@ -212,7 +212,8 @@ static void cleanup_thread(void)
212 free(thread_data);
213 }
214
215 -static int mark_link(struct object *obj, int type, void *data, struct fsck_options *options)
215 +static int mark_link(struct object *obj, enum object_type type,
216 + void *data, struct fsck_options *options)
217 {
218 if (!obj)
219 return -1;
builtin/unpack-objects.c
+2 -1
@@ -187,7 +187,8 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
187 * that have reachability requirements and calls this function.
188 * Verify its reachability and validity recursively and write it out.
189 */
190 -static int check_object(struct object *obj, int type, void *data, struct fsck_options *options)
190 +static int check_object(struct object *obj, enum object_type type,
191 + void *data, struct fsck_options *options)
192 {
193 struct obj_buffer *obj_buf;
194
fsck.h
+2 -1
@@ -23,7 +23,8 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type);
23 * <0 error signaled and abort
24 * >0 error signaled and do not abort
25 */
26 -typedef int (*fsck_walk_func)(struct object *obj, int type, void *data, struct fsck_options *options);
26 +typedef int (*fsck_walk_func)(struct object *obj, enum object_type object_type,
27 + void *data, struct fsck_options *options);
28
29 /* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
30 typedef int (*fsck_error)(struct fsck_options *o,