Skip to content

Commit a1aad71

Browse files
avargitster
authored andcommitted
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 355885d (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d385784 commit a1aad71

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

builtin/fsck.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ static int traverse_reachable(void)
192192
return !!result;
193193
}
194194

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)
196197
{
197198
if (!obj)
198199
return 1;

builtin/index-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ static void cleanup_thread(void)
212212
free(thread_data);
213213
}
214214

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)
216217
{
217218
if (!obj)
218219
return -1;

builtin/unpack-objects.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
187187
* that have reachability requirements and calls this function.
188188
* Verify its reachability and validity recursively and write it out.
189189
*/
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)
191192
{
192193
struct obj_buffer *obj_buf;
193194

fsck.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type);
2323
* <0 error signaled and abort
2424
* >0 error signaled and do not abort
2525
*/
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);
2728

2829
/* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
2930
typedef int (*fsck_error)(struct fsck_options *o,

0 commit comments

Comments
 (0)