Skip to content

Commit 63e14ee

Browse files
peffgitster
authored andcommitted
refs: mark unused each_ref_fn parameters
Functions used with for_each_ref(), etc, need to conform to the each_ref_fn interface. But most of them don't need every parameter; let's annotate the unused ones to quiet -Wunused-parameter. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9b24034 commit 63e14ee

39 files changed

+132
-84
lines changed

bisect.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
441441
}
442442

443443
static int register_ref(const char *refname, const struct object_id *oid,
444-
int flags, void *cb_data)
444+
int UNUSED(flags), void *UNUSED(cb_data))
445445
{
446446
struct strbuf good_prefix = STRBUF_INIT;
447447
strbuf_addstr(&good_prefix, term_good);
@@ -1160,8 +1160,9 @@ int estimate_bisect_steps(int all)
11601160
return (e < 3 * x) ? n : n - 1;
11611161
}
11621162

1163-
static int mark_for_removal(const char *refname, const struct object_id *oid,
1164-
int flag, void *cb_data)
1163+
static int mark_for_removal(const char *refname,
1164+
const struct object_id *UNUSED(oid),
1165+
int UNUSED(flag), void *cb_data)
11651166
{
11661167
struct string_list *refs = cb_data;
11671168
char *ref = xstrfmt("refs/bisect%s", refname);

builtin/bisect--helper.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,9 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
329329
return 0;
330330
}
331331

332-
static int inc_nr(const char *refname, const struct object_id *oid,
333-
int flag, void *cb_data)
332+
static int inc_nr(const char *UNUSED(refname),
333+
const struct object_id *UNUSED(oid),
334+
int UNUSED(flag), void *cb_data)
334335
{
335336
unsigned int *nr = (unsigned int *)cb_data;
336337
(*nr)++;
@@ -518,7 +519,7 @@ static int bisect_append_log_quoted(const char **argv)
518519
}
519520

520521
static int add_bisect_ref(const char *refname, const struct object_id *oid,
521-
int flags, void *cb)
522+
int UNUSED(flags), void *cb)
522523
{
523524
struct add_bisect_ref_data *data = cb;
524525

@@ -1134,8 +1135,9 @@ static int bisect_visualize(struct bisect_terms *terms, const char **argv, int a
11341135
return res;
11351136
}
11361137

1137-
static int get_first_good(const char *refname, const struct object_id *oid,
1138-
int flag, void *cb_data)
1138+
static int get_first_good(const char *UNUSED(refname),
1139+
const struct object_id *oid,
1140+
int UNUSED(flag), void *cb_data)
11391141
{
11401142
oidcpy(cb_data, oid);
11411143
return 1;

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
990990

991991
static int add_pending_uninteresting_ref(const char *refname,
992992
const struct object_id *oid,
993-
int flags, void *cb_data)
993+
int UNUSED(flags), void *cb_data)
994994
{
995995
add_pending_oid(cb_data, refname, oid, UNINTERESTING);
996996
return 0;

builtin/describe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ static void add_to_known_names(const char *path,
140140
}
141141
}
142142

143-
static int get_name(const char *path, const struct object_id *oid, int flag, void *cb_data)
143+
static int get_name(const char *path, const struct object_id *oid,
144+
int UNUSED(flag), void *UNUSED(cb_data))
144145
{
145146
int is_tag = 0;
146147
struct object_id peeled;

builtin/fetch.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
329329

330330
static int add_one_refname(const char *refname,
331331
const struct object_id *oid,
332-
int flag, void *cbdata)
332+
int UNUSED(flag), void *cbdata)
333333
{
334334
struct hashmap *refname_map = cbdata;
335335

@@ -1462,8 +1462,9 @@ static void set_option(struct transport *transport, const char *name, const char
14621462
}
14631463

14641464

1465-
static int add_oid(const char *refname, const struct object_id *oid, int flags,
1466-
void *cb_data)
1465+
static int add_oid(const char *UNUSED(refname),
1466+
const struct object_id *oid,
1467+
int UNUSED(flags), void *cb_data)
14671468
{
14681469
struct oid_array *oids = cb_data;
14691470

builtin/fsck.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,9 @@ static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid
502502
return 0;
503503
}
504504

505-
static int fsck_handle_reflog(const char *logname, const struct object_id *oid,
506-
int flag, void *cb_data)
505+
static int fsck_handle_reflog(const char *logname,
506+
const struct object_id *UNUSED(oid),
507+
int UNUSED(flag), void *cb_data)
507508
{
508509
struct strbuf refname = STRBUF_INIT;
509510

@@ -514,7 +515,7 @@ static int fsck_handle_reflog(const char *logname, const struct object_id *oid,
514515
}
515516

516517
static int fsck_handle_ref(const char *refname, const struct object_id *oid,
517-
int flag, void *cb_data)
518+
int UNUSED(flag), void *UNUSED(cb_data))
518519
{
519520
struct object *obj;
520521

builtin/gc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,9 @@ struct cg_auto_data {
782782
int limit;
783783
};
784784

785-
static int dfs_on_ref(const char *refname,
786-
const struct object_id *oid, int flags,
785+
static int dfs_on_ref(const char *UNUSED(refname),
786+
const struct object_id *oid,
787+
int UNUSED(flags),
787788
void *cb_data)
788789
{
789790
struct cg_auto_data *data = (struct cg_auto_data *)cb_data;

builtin/name-rev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ static int cmp_by_tag_and_age(const void *a_, const void *b_)
344344
return a->taggerdate != b->taggerdate;
345345
}
346346

347-
static int name_ref(const char *path, const struct object_id *oid, int flags, void *cb_data)
347+
static int name_ref(const char *path, const struct object_id *oid,
348+
int UNUSED(flags), void *cb_data)
348349
{
349350
struct object *o = parse_object(the_repository, oid);
350351
struct name_ref_data *data = cb_data;

builtin/pack-objects.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ static enum write_one_status write_one(struct hashfile *f,
759759
return WRITE_ONE_WRITTEN;
760760
}
761761

762-
static int mark_tagged(const char *path, const struct object_id *oid, int flag,
763-
void *cb_data)
762+
static int mark_tagged(const char *UNUSED(path), const struct object_id *oid,
763+
int UNUSED(flag), void *UNUSED(cb_data))
764764
{
765765
struct object_id peeled;
766766
struct object_entry *entry = packlist_find(&to_pack, oid);
@@ -3035,7 +3035,8 @@ static void add_tag_chain(const struct object_id *oid)
30353035
}
30363036
}
30373037

3038-
static int add_ref_tag(const char *tag, const struct object_id *oid, int flag, void *cb_data)
3038+
static int add_ref_tag(const char *UNUSED(tag), const struct object_id *oid,
3039+
int UNUSED(flag), void *UNUSED(cb_data))
30393040
{
30403041
struct object_id peeled;
30413042

@@ -3950,8 +3951,9 @@ static void record_recent_commit(struct commit *commit, void *data)
39503951
}
39513952

39523953
static int mark_bitmap_preferred_tip(const char *refname,
3953-
const struct object_id *oid, int flags,
3954-
void *_data)
3954+
const struct object_id *oid,
3955+
int UNUSED(flags),
3956+
void *UNUSED(data))
39553957
{
39563958
struct object_id peeled;
39573959
struct object *object;

builtin/receive-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static void show_ref(const char *path, const struct object_id *oid)
291291
}
292292

293293
static int show_ref_cb(const char *path_full, const struct object_id *oid,
294-
int flag, void *data)
294+
int UNUSED(flag), void *data)
295295
{
296296
struct oidset *seen = data;
297297
const char *path = strip_namespace(path_full);

0 commit comments

Comments
 (0)