Skip to content

Commit 61bdc7c

Browse files
peffgitster
authored andcommitted
diff: mark unused parameters in callbacks
The diff code provides a format_callback interface, but not every callback needs each parameter (e.g., the "opt" and "data" parameters are frequently left unused). Likewise for the output_prefix callback, the low-level change/add_remove interfaces, the callbacks used by xdi_diff(), etc. Mark unused arguments in the callback implementations to quiet -Wunused-parameter. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8157ed4 commit 61bdc7c

15 files changed

+41
-30
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ static int run_update(struct add_i_state *s, const struct pathspec *ps,
724724
}
725725

726726
static void revert_from_diff(struct diff_queue_struct *q,
727-
struct diff_options *opt, void *data)
727+
struct diff_options *opt, void *data UNUSED)
728728
{
729729
int i, add_flags = ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE;
730730

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int fix_unmerged_status(struct diff_filepair *p,
8888
}
8989

9090
static void update_callback(struct diff_queue_struct *q,
91-
struct diff_options *opt, void *cbdata)
91+
struct diff_options *opt UNUSED, void *cbdata)
9292
{
9393
int i;
9494
struct update_callback_data *data = cbdata;

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ static const char *anonymize_oid(const char *oid_hex)
409409
}
410410

411411
static void show_filemodify(struct diff_queue_struct *q,
412-
struct diff_options *options, void *data)
412+
struct diff_options *options UNUSED, void *data)
413413
{
414414
int i;
415415
struct string_list *changed = data;

builtin/merge-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void *origin(struct merge_list *entry, unsigned long *size)
9898
return NULL;
9999
}
100100

101-
static int show_outf(void *priv_, mmbuffer_t *mb, int nbuf)
101+
static int show_outf(void *priv UNUSED, mmbuffer_t *mb, int nbuf)
102102
{
103103
int i;
104104
for (i = 0; i < nbuf; i++)

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
776776
}
777777

778778
static void count_diff_files(struct diff_queue_struct *q,
779-
struct diff_options *opt, void *data)
779+
struct diff_options *opt UNUSED, void *data)
780780
{
781781
int *count = data;
782782

builtin/rerere.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static const char * const rerere_usage[] = {
1414
NULL,
1515
};
1616

17-
static int outf(void *dummy, mmbuffer_t *ptr, int nbuf)
17+
static int outf(void *dummy UNUSED, mmbuffer_t *ptr, int nbuf)
1818
{
1919
int i;
2020
for (i = 0; i < nbuf; i++)

builtin/reset.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ static void print_new_head_line(struct commit *commit)
133133
}
134134

135135
static void update_index_from_diff(struct diff_queue_struct *q,
136-
struct diff_options *opt, void *data)
136+
struct diff_options *opt UNUSED,
137+
void *data)
137138
{
138139
int i;
139140
int intent_to_add = *(int *)data;

builtin/submodule--helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ static void prepare_submodule_summary(struct summary_cb *info,
10431043
}
10441044

10451045
static void submodule_summary_callback(struct diff_queue_struct *q,
1046-
struct diff_options *options,
1046+
struct diff_options *options UNUSED,
10471047
void *data)
10481048
{
10491049
int i;

combine-diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ struct combine_diff_state {
372372
static void consume_hunk(void *state_,
373373
long ob, long on,
374374
long nb, long nn,
375-
const char *funcline, long funclen)
375+
const char *func UNUSED, long funclen UNUSED)
376376
{
377377
struct combine_diff_state *state = state_;
378378

diff-lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ int index_differs_from(struct repository *r,
673673
return (has_changes != 0);
674674
}
675675

676-
static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
676+
static struct strbuf *idiff_prefix_cb(struct diff_options *opt UNUSED, void *data)
677677
{
678678
return data;
679679
}

0 commit comments

Comments
 (0)