Skip to content

Commit be252d3

Browse files
peffgitster
authored andcommitted
for_each_object: mark unused callback parameters
The for_each_{loose,packed}_object interface uses callback functions, but not every callback needs all of the parameters. Mark the unused ones to satisfy -Wunused-parameter. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c50dca2 commit be252d3

File tree

14 files changed

+56
-45
lines changed

14 files changed

+56
-45
lines changed

builtin/cat-file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,16 +559,16 @@ static int batch_object_cb(const struct object_id *oid, void *vdata)
559559
}
560560

561561
static int collect_loose_object(const struct object_id *oid,
562-
const char *path,
562+
const char *path UNUSED,
563563
void *data)
564564
{
565565
oid_array_append(data, oid);
566566
return 0;
567567
}
568568

569569
static int collect_packed_object(const struct object_id *oid,
570-
struct packed_git *pack,
571-
uint32_t pos,
570+
struct packed_git *pack UNUSED,
571+
uint32_t pos UNUSED,
572572
void *data)
573573
{
574574
oid_array_append(data, oid);
@@ -591,7 +591,7 @@ static int batch_unordered_object(const struct object_id *oid,
591591
}
592592

593593
static int batch_unordered_loose(const struct object_id *oid,
594-
const char *path,
594+
const char *path UNUSED,
595595
void *data)
596596
{
597597
return batch_unordered_object(oid, NULL, 0, data);

builtin/count-objects.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ static void loose_garbage(const char *path)
5757
report_garbage(PACKDIR_FILE_GARBAGE, path);
5858
}
5959

60-
static int count_loose(const struct object_id *oid, const char *path, void *data)
60+
static int count_loose(const struct object_id *oid, const char *path,
61+
void *data UNUSED)
6162
{
6263
struct stat st;
6364

@@ -72,7 +73,8 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
7273
return 0;
7374
}
7475

75-
static int count_cruft(const char *basename, const char *path, void *data)
76+
static int count_cruft(const char *basename UNUSED, const char *path,
77+
void *data UNUSED)
7678
{
7779
loose_garbage(path);
7880
return 0;

builtin/fsck.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,17 @@ static void mark_unreachable_referents(const struct object_id *oid)
233233
}
234234

235235
static int mark_loose_unreachable_referents(const struct object_id *oid,
236-
const char *path,
237-
void *data)
236+
const char *path UNUSED,
237+
void *data UNUSED)
238238
{
239239
mark_unreachable_referents(oid);
240240
return 0;
241241
}
242242

243243
static int mark_packed_unreachable_referents(const struct object_id *oid,
244-
struct packed_git *pack,
245-
uint32_t pos,
246-
void *data)
244+
struct packed_git *pack UNUSED,
245+
uint32_t pos UNUSED,
246+
void *data UNUSED)
247247
{
248248
mark_unreachable_referents(oid);
249249
return 0;
@@ -661,14 +661,15 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
661661
return 0; /* keep checking other objects, even if we saw an error */
662662
}
663663

664-
static int fsck_cruft(const char *basename, const char *path, void *data)
664+
static int fsck_cruft(const char *basename, const char *path,
665+
void *data UNUSED)
665666
{
666667
if (!starts_with(basename, "tmp_obj_"))
667668
fprintf_ln(stderr, _("bad sha1 file: %s"), path);
668669
return 0;
669670
}
670671

671-
static int fsck_subdir(unsigned int nr, const char *path, void *data)
672+
static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)
672673
{
673674
struct for_each_loose_cb *cb_data = data;
674675
struct progress *progress = cb_data->progress;
@@ -803,17 +804,17 @@ static void mark_object_for_connectivity(const struct object_id *oid)
803804
}
804805

805806
static int mark_loose_for_connectivity(const struct object_id *oid,
806-
const char *path,
807-
void *data)
807+
const char *path UNUSED,
808+
void *data UNUSED)
808809
{
809810
mark_object_for_connectivity(oid);
810811
return 0;
811812
}
812813

813814
static int mark_packed_for_connectivity(const struct object_id *oid,
814-
struct packed_git *pack,
815-
uint32_t pos,
816-
void *data)
815+
struct packed_git *pack UNUSED,
816+
uint32_t pos UNUSED,
817+
void *data UNUSED)
817818
{
818819
mark_object_for_connectivity(oid);
819820
return 0;

builtin/gc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -976,9 +976,9 @@ struct write_loose_object_data {
976976

977977
static int loose_object_auto_limit = 100;
978978

979-
static int loose_object_count(const struct object_id *oid,
980-
const char *path,
981-
void *data)
979+
static int loose_object_count(const struct object_id *oid UNUSED,
980+
const char *path UNUSED,
981+
void *data)
982982
{
983983
int *count = (int*)data;
984984
if (++(*count) >= loose_object_auto_limit)
@@ -1003,15 +1003,15 @@ static int loose_object_auto_condition(void)
10031003
NULL, NULL, &count);
10041004
}
10051005

1006-
static int bail_on_loose(const struct object_id *oid,
1007-
const char *path,
1008-
void *data)
1006+
static int bail_on_loose(const struct object_id *oid UNUSED,
1007+
const char *path UNUSED,
1008+
void *data UNUSED)
10091009
{
10101010
return 1;
10111011
}
10121012

10131013
static int write_loose_object_to_stdin(const struct object_id *oid,
1014-
const char *path,
1014+
const char *path UNUSED,
10151015
void *data)
10161016
{
10171017
struct write_loose_object_data *d = (struct write_loose_object_data *)data;

builtin/pack-objects.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3260,13 +3260,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,
32603260
return 0;
32613261
}
32623262

3263-
static void show_commit_pack_hint(struct commit *commit, void *_data)
3263+
static void show_commit_pack_hint(struct commit *commit UNUSED,
3264+
void *data UNUSED)
32643265
{
32653266
/* nothing to do; commits don't have a namehash */
32663267
}
32673268

32683269
static void show_object_pack_hint(struct object *object, const char *name,
3269-
void *_data)
3270+
void *data UNUSED)
32703271
{
32713272
struct object_entry *oe = packlist_find(&to_pack, &object->oid);
32723273
if (!oe)
@@ -3762,7 +3763,7 @@ static void show_edge(struct commit *commit)
37623763
static int add_object_in_unpacked_pack(const struct object_id *oid,
37633764
struct packed_git *pack,
37643765
uint32_t pos,
3765-
void *_data)
3766+
void *data UNUSED)
37663767
{
37673768
if (cruft) {
37683769
off_t offset;
@@ -3796,7 +3797,7 @@ static void add_objects_in_unpacked_packs(void)
37963797
}
37973798

37983799
static int add_loose_object(const struct object_id *oid, const char *path,
3799-
void *data)
3800+
void *data UNUSED)
38003801
{
38013802
enum object_type type = oid_object_info(the_repository, oid, NULL);
38023803

@@ -3947,13 +3948,13 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
39473948
}
39483949

39493950
static void record_recent_object(struct object *obj,
3950-
const char *name,
3951-
void *data)
3951+
const char *name UNUSED,
3952+
void *data UNUSED)
39523953
{
39533954
oid_array_append(&recent_objects, &obj->oid);
39543955
}
39553956

3956-
static void record_recent_commit(struct commit *commit, void *data)
3957+
static void record_recent_commit(struct commit *commit, void *data UNUSED)
39573958
{
39583959
oid_array_append(&recent_objects, &commit->object.oid);
39593960
}

builtin/prune.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
9898
return 0;
9999
}
100100

101-
static int prune_cruft(const char *basename, const char *path, void *data)
101+
static int prune_cruft(const char *basename, const char *path,
102+
void *data UNUSED)
102103
{
103104
if (starts_with(basename, "tmp_obj_"))
104105
prune_tmp_file(path);
@@ -107,7 +108,8 @@ static int prune_cruft(const char *basename, const char *path, void *data)
107108
return 0;
108109
}
109110

110-
static int prune_subdir(unsigned int nr, const char *path, void *data)
111+
static int prune_subdir(unsigned int nr UNUSED, const char *path,
112+
void *data UNUSED)
111113
{
112114
if (!show_only)
113115
rmdir(path);

builtin/repack.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@ static void prepare_pack_objects(struct child_process *cmd,
182182
* Write oid to the given struct child_process's stdin, starting it first if
183183
* necessary.
184184
*/
185-
static int write_oid(const struct object_id *oid, struct packed_git *pack,
186-
uint32_t pos, void *data)
185+
static int write_oid(const struct object_id *oid,
186+
struct packed_git *pack UNUSED,
187+
uint32_t pos UNUSED, void *data)
187188
{
188189
struct child_process *cmd = data;
189190

builtin/rev-list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ static inline void finish_object__ma(struct object *obj)
257257
}
258258
}
259259

260-
static int finish_object(struct object *obj, const char *name, void *cb_data)
260+
static int finish_object(struct object *obj, const char *name UNUSED,
261+
void *cb_data)
261262
{
262263
struct rev_list_info *info = cb_data;
263264
if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {

diagnose.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset)
4343
return error(_("invalid --%s value '%s'"), opt->long_name, arg);
4444
}
4545

46-
static void dir_file_stats_objects(const char *full_path, size_t full_path_len,
46+
static void dir_file_stats_objects(const char *full_path,
47+
size_t full_path_len UNUSED,
4748
const char *file_name, void *data)
4849
{
4950
struct strbuf *buf = data;

midx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ struct clear_midx_data {
16071607
const char *ext;
16081608
};
16091609

1610-
static void clear_midx_file_ext(const char *full_path, size_t full_path_len,
1610+
static void clear_midx_file_ext(const char *full_path, size_t full_path_len UNUSED,
16111611
const char *file_name, void *_data)
16121612
{
16131613
struct clear_midx_data *data = _data;

0 commit comments

Comments
 (0)