Skip to content

Commit c006e9f

Browse files
peffgitster
authored andcommitted
refs: mark unused reflog callback parameters
Functions used with for_each_reflog_ent() need to conform to a particular interface, but not every function needs all of the parameters. Mark the unused ones to make -Wunused-parameter happy. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 63e14ee commit c006e9f

File tree

10 files changed

+55
-32
lines changed

10 files changed

+55
-32
lines changed

builtin/fsck.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,9 @@ static void fsck_handle_reflog_oid(const char *refname, struct object_id *oid,
488488
}
489489

490490
static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid,
491-
const char *email, timestamp_t timestamp, int tz,
492-
const char *message, void *cb_data)
491+
const char *UNUSED(email),
492+
timestamp_t timestamp, int UNUSED(tz),
493+
const char *UNUSED(message), void *cb_data)
493494
{
494495
const char *refname = cb_data;
495496

builtin/stash.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,12 @@ static int apply_stash(int argc, const char **argv, const char *prefix)
638638
return ret;
639639
}
640640

641-
static int reject_reflog_ent(struct object_id *ooid, struct object_id *noid,
642-
const char *email, timestamp_t timestamp, int tz,
643-
const char *message, void *cb_data)
641+
static int reject_reflog_ent(struct object_id *UNUSED(ooid),
642+
struct object_id *UNUSED(noid),
643+
const char *UNUSED(email),
644+
timestamp_t UNUSED(timestamp),
645+
int UNUSED(tz), const char *UNUSED(message),
646+
void *UNUSED(cb_data))
644647
{
645648
return 1;
646649
}

commit.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,9 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs)
951951
}
952952

953953
static int collect_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
954-
const char *ident, timestamp_t timestamp,
955-
int tz, const char *message, void *cbdata)
954+
const char *UNUSED(ident),
955+
timestamp_t UNUSED(timestamp), int UNUSED(tz),
956+
const char *UNUSED(message), void *cbdata)
956957
{
957958
struct rev_collect *revs = cbdata;
958959

object-name.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,8 +1385,11 @@ struct grab_nth_branch_switch_cbdata {
13851385
struct strbuf *sb;
13861386
};
13871387

1388-
static int grab_nth_branch_switch(struct object_id *ooid, struct object_id *noid,
1389-
const char *email, timestamp_t timestamp, int tz,
1388+
static int grab_nth_branch_switch(struct object_id *UNUSED(ooid),
1389+
struct object_id *UNUSED(noid),
1390+
const char *UNUSED(email),
1391+
timestamp_t UNUSED(timestamp),
1392+
int UNUSED(tz),
13901393
const char *message, void *cb_data)
13911394
{
13921395
struct grab_nth_branch_switch_cbdata *cb = cb_data;

reflog.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,9 @@ static int unreachable(struct expire_reflog_policy_cb *cb, struct commit *commit
240240
* Return true iff the specified reflog entry should be expired.
241241
*/
242242
int should_expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
243-
const char *email, timestamp_t timestamp, int tz,
244-
const char *message, void *cb_data)
243+
const char *UNUSED(email),
244+
timestamp_t timestamp, int UNUSED(tz),
245+
const char *UNUSED(message), void *cb_data)
245246
{
246247
struct expire_reflog_policy_cb *cb = cb_data;
247248
struct commit *old_commit, *new_commit;
@@ -379,9 +380,11 @@ void reflog_expiry_cleanup(void *cb_data)
379380
}
380381
}
381382

382-
int count_reflog_ent(struct object_id *ooid, struct object_id *noid,
383-
const char *email, timestamp_t timestamp, int tz,
384-
const char *message, void *cb_data)
383+
int count_reflog_ent(struct object_id *UNUSED(ooid),
384+
struct object_id *UNUSED(noid),
385+
const char *UNUSED(email),
386+
timestamp_t timestamp, int UNUSED(tz),
387+
const char *UNUSED(message), void *cb_data)
385388
{
386389
struct cmd_reflog_expire_cb *cb = cb_data;
387390
if (!cb->expire_total || timestamp < cb->expire_total)

refs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,9 @@ static void set_read_ref_cutoffs(struct read_ref_at_cb *cb,
894894
}
895895

896896
static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
897-
const char *email, timestamp_t timestamp, int tz,
898-
const char *message, void *cb_data)
897+
const char *UNUSED(email),
898+
timestamp_t timestamp, int tz,
899+
const char *message, void *cb_data)
899900
{
900901
struct read_ref_at_cb *cb = cb_data;
901902
int reached_count;
@@ -950,8 +951,9 @@ static int read_ref_at_ent_newest(struct object_id *UNUSED(ooid),
950951
}
951952

952953
static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid,
953-
const char *email, timestamp_t timestamp,
954-
int tz, const char *message, void *cb_data)
954+
const char *UNUSED(email),
955+
timestamp_t timestamp, int tz,
956+
const char *message, void *cb_data)
955957
{
956958
struct read_ref_at_cb *cb = cb_data;
957959

remote.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,19 +2577,22 @@ struct check_and_collect_until_cb_data {
25772577
};
25782578

25792579
/* Get the timestamp of the latest entry. */
2580-
static int peek_reflog(struct object_id *o_oid, struct object_id *n_oid,
2581-
const char *ident, timestamp_t timestamp,
2582-
int tz, const char *message, void *cb_data)
2580+
static int peek_reflog(struct object_id *UNUSED(o_oid),
2581+
struct object_id *UNUSED(n_oid),
2582+
const char *UNUSED(ident),
2583+
timestamp_t timestamp, int UNUSED(tz),
2584+
const char *UNUSED(message), void *cb_data)
25832585
{
25842586
timestamp_t *ts = cb_data;
25852587
*ts = timestamp;
25862588
return 1;
25872589
}
25882590

2589-
static int check_and_collect_until(struct object_id *o_oid,
2591+
static int check_and_collect_until(struct object_id *UNUSED(o_oid),
25902592
struct object_id *n_oid,
2591-
const char *ident, timestamp_t timestamp,
2592-
int tz, const char *message, void *cb_data)
2593+
const char *UNUSED(ident),
2594+
timestamp_t timestamp, int UNUSED(tz),
2595+
const char *UNUSED(message), void *cb_data)
25932596
{
25942597
struct commit *commit;
25952598
struct check_and_collect_until_cb_data *cb = cb_data;

revision.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,8 +1619,11 @@ static void handle_one_reflog_commit(struct object_id *oid, void *cb_data)
16191619
}
16201620

16211621
static int handle_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
1622-
const char *email, timestamp_t timestamp, int tz,
1623-
const char *message, void *cb_data)
1622+
const char *UNUSED(email),
1623+
timestamp_t UNUSED(timestamp),
1624+
int UNUSED(tz),
1625+
const char *UNUSED(message),
1626+
void *cb_data)
16241627
{
16251628
handle_one_reflog_commit(ooid, cb_data);
16261629
handle_one_reflog_commit(noid, cb_data);

t/helper/test-ref-store.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static int cmd_for_each_reflog(struct ref_store *refs, const char **argv)
207207

208208
static int each_reflog(struct object_id *old_oid, struct object_id *new_oid,
209209
const char *committer, timestamp_t timestamp,
210-
int tz, const char *msg, void *cb_data)
210+
int tz, const char *msg, void *UNUSED(cb_data))
211211
{
212212
printf("%s %s %s %" PRItime " %+05d%s%s", oid_to_hex(old_oid),
213213
oid_to_hex(new_oid), committer, timestamp, tz,

wt-status.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,11 @@ static void wt_longstatus_print_changed(struct wt_status *s)
947947
wt_longstatus_print_trailer(s);
948948
}
949949

950-
static int stash_count_refs(struct object_id *ooid, struct object_id *noid,
951-
const char *email, timestamp_t timestamp, int tz,
952-
const char *message, void *cb_data)
950+
static int stash_count_refs(struct object_id *UNUSED(ooid),
951+
struct object_id *UNUSED(noid),
952+
const char *UNUSED(email),
953+
timestamp_t UNUSED(timestamp), int UNUSED(tz),
954+
const char *UNUSED(message), void *cb_data)
953955
{
954956
int *c = cb_data;
955957
(*c)++;
@@ -1612,8 +1614,10 @@ struct grab_1st_switch_cbdata {
16121614
struct object_id noid;
16131615
};
16141616

1615-
static int grab_1st_switch(struct object_id *ooid, struct object_id *noid,
1616-
const char *email, timestamp_t timestamp, int tz,
1617+
static int grab_1st_switch(struct object_id *UNUSED(ooid),
1618+
struct object_id *noid,
1619+
const char *UNUSED(email),
1620+
timestamp_t UNUSED(timestamp), int UNUSED(tz),
16171621
const char *message, void *cb_data)
16181622
{
16191623
struct grab_1st_switch_cbdata *cb = cb_data;

0 commit comments

Comments
 (0)