Skip to content

Commit c50dca2

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9ec03b5 commit c50dca2

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

builtin/pack-objects.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
15901590

15911591
static int add_object_entry_from_bitmap(const struct object_id *oid,
15921592
enum object_type type,
1593-
int flags, uint32_t name_hash,
1593+
int flags UNUSED, uint32_t name_hash,
15941594
struct packed_git *pack, off_t offset)
15951595
{
15961596
display_progress(progress_state, ++nr_seen);
@@ -3464,7 +3464,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type
34643464
return;
34653465
}
34663466

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)
34683468
{
34693469
/*
34703470
* 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)
34843484
show_cruft_object((struct object*)commit, NULL, data);
34853485
}
34863486

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)
34883488
{
34893489
return !has_object_kept_pack(&obj->oid, IN_CORE_KEEP_PACKS);
34903490
}
@@ -3663,7 +3663,7 @@ static void read_object_list_from_stdin(void)
36633663
}
36643664
}
36653665

3666-
static void show_commit(struct commit *commit, void *data)
3666+
static void show_commit(struct commit *commit, void *data UNUSED)
36673667
{
36683668
add_object_entry(&commit->object.oid, OBJ_COMMIT, NULL, 0);
36693669

@@ -3674,7 +3674,8 @@ static void show_commit(struct commit *commit, void *data)
36743674
propagate_island_marks(commit);
36753675
}
36763676

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)
36783679
{
36793680
add_preferred_base_object(name);
36803681
add_object_entry(&obj->oid, obj->type, name, 0);

builtin/rev-list.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,11 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
362362

363363
static int show_object_fast(
364364
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)
370370
{
371371
fprintf(stdout, "%s\n", oid_to_hex(oid));
372372
return 1;

pack-bitmap.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,8 @@ static void show_object(struct object *object, const char *name, void *data_)
951951
bitmap_set(data->base, bitmap_pos);
952952
}
953953

954-
static void show_commit(struct commit *commit, void *data)
954+
static void show_commit(struct commit *commit UNUSED,
955+
void *data UNUSED)
955956
{
956957
}
957958

@@ -1940,7 +1941,8 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
19401941
type_name(bitmap_type));
19411942
}
19421943

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,
19441946
void *data)
19451947
{
19461948
struct bitmap_test_data *tdata = data;

reachable.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ static int add_one_ref(const char *path, const struct object_id *oid,
4848
* The traversal will have already marked us as SEEN, so we
4949
* only need to handle any progress reporting here.
5050
*/
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)
5254
{
5355
update_progress(data);
5456
}
@@ -202,10 +204,10 @@ int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
202204

203205
static int mark_object_seen(const struct object_id *oid,
204206
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)
209211
{
210212
struct object *obj = lookup_object_by_type(the_repository, oid, type);
211213
if (!obj)

0 commit comments

Comments
 (0)