list-objects: mark unused callback parameters
Our graph-traversal functions take callbacks for showing commits and objects, but not all callbacks need each parameter. Likewise for the similar traverse_bitmap_commit_list(), which has a different interface but serves the same purpose. And the include_check mechanism, which passes along a void pointer which is not always used. Mark the unused ones to to make -Wunused-parameter happy. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Feb 24, 2023 at 01:39 UTC
c50dca2a18077306eb6796938d3d01c76590b4c6
4 files changed
+22
-17
builtin/pack-objects.c
+6
-5
@@ -1590,7 +1590,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
1590
1591
static int add_object_entry_from_bitmap(const struct object_id *oid,
1592
enum object_type type,
1593
- int flags, uint32_t name_hash,
1593
+ int flags UNUSED, uint32_t name_hash,
1594
struct packed_git *pack, off_t offset)
1595
{
1596
display_progress(progress_state, ++nr_seen);
@@ -3464,7 +3464,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type
3464
return;
3465
}
3466
3467
-static void show_cruft_object(struct object *obj, const char *name, void *data)
3467
+static void show_cruft_object(struct object *obj, const char *name, void *data UNUSED)
3468
{
3469
/*
3470
* if we did not record it earlier, it's at least as old as our
@@ -3484,7 +3484,7 @@ static void show_cruft_commit(struct commit *commit, void *data)
3484
show_cruft_object((struct object*)commit, NULL, data);
3485
}
3486
3487
-static int cruft_include_check_obj(struct object *obj, void *data)
3487
+static int cruft_include_check_obj(struct object *obj, void *data UNUSED)
3488
{
3489
return !has_object_kept_pack(&obj->oid, IN_CORE_KEEP_PACKS);
3490
}
@@ -3663,7 +3663,7 @@ static void read_object_list_from_stdin(void)
3663
}
3664
}
3665
3666
-static void show_commit(struct commit *commit, void *data)
3666
+static void show_commit(struct commit *commit, void *data UNUSED)
3667
{
3668
add_object_entry(&commit->object.oid, OBJ_COMMIT, NULL, 0);
3669
@@ -3674,7 +3674,8 @@ static void show_commit(struct commit *commit, void *data)
3674
propagate_island_marks(commit);
3675
}
3676
3677
-static void show_object(struct object *obj, const char *name, void *data)
3677
+static void show_object(struct object *obj, const char *name,
3678
+ void *data UNUSED)
3679
{
3680
add_preferred_base_object(name);
3681
add_object_entry(&obj->oid, obj->type, name, 0);
builtin/rev-list.c
+5
-5
@@ -362,11 +362,11 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
362
363
static int show_object_fast(
364
const struct object_id *oid,
365
- enum object_type type,
366
- int exclude,
367
- uint32_t name_hash,
368
- struct packed_git *found_pack,
369
- off_t found_offset)
365
+ enum object_type type UNUSED,
366
+ int exclude UNUSED,
367
+ uint32_t name_hash UNUSED,
368
+ struct packed_git *found_pack UNUSED,
369
+ off_t found_offset UNUSED)
370
{
371
fprintf(stdout, "%s\n", oid_to_hex(oid));
372
return 1;
pack-bitmap.c
+4
-2
@@ -951,7 +951,8 @@ static void show_object(struct object *object, const char *name, void *data_)
951
bitmap_set(data->base, bitmap_pos);
952
}
953
954
-static void show_commit(struct commit *commit, void *data)
954
+static void show_commit(struct commit *commit UNUSED,
955
+ void *data UNUSED)
956
{
957
}
958
@@ -1940,7 +1941,8 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
1941
type_name(bitmap_type));
1942
}
1943
1943
-static void test_show_object(struct object *object, const char *name,
1944
+static void test_show_object(struct object *object,
1945
+ const char *name UNUSED,
1946
void *data)
1947
{
1948
struct bitmap_test_data *tdata = data;
reachable.c
+7
-5
@@ -48,7 +48,9 @@ static int add_one_ref(const char *path, const struct object_id *oid,
48
* The traversal will have already marked us as SEEN, so we
49
* only need to handle any progress reporting here.
50
*/
51
-static void mark_object(struct object *obj, const char *name, void *data)
51
+static void mark_object(struct object *obj UNUSED,
52
+ const char *name UNUSED,
53
+ void *data)
54
{
55
update_progress(data);
56
}
@@ -202,10 +204,10 @@ int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
204
205
static int mark_object_seen(const struct object_id *oid,
206
enum object_type type,
205
- int exclude,
206
- uint32_t name_hash,
207
- struct packed_git *found_pack,
208
- off_t found_offset)
207
+ int exclude UNUSED,
208
+ uint32_t name_hash UNUSED,
209
+ struct packed_git *found_pack UNUSED,
210
+ off_t found_offset UNUSED)
211
{
212
struct object *obj = lookup_object_by_type(the_repository, oid, type);
213
if (!obj)