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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 8a052c7..87c8b2d 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -329,8 +329,9 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
return 0;
}
-static int inc_nr(const char *refname, const struct object_id *oid,
- int flag, void *cb_data)
+static int inc_nr(const char *UNUSED(refname),
+ const struct object_id *UNUSED(oid),
+ int UNUSED(flag), void *cb_data)
{
unsigned int *nr = (unsigned int *)cb_data;
(*nr)++;
@@ -518,7 +519,7 @@ static int bisect_append_log_quoted(const char **argv)
}
static int add_bisect_ref(const char *refname, const struct object_id *oid,
- int flags, void *cb)
+ int UNUSED(flags), void *cb)
{
struct add_bisect_ref_data *data = cb;
@@ -1134,8 +1135,9 @@ static int bisect_visualize(struct bisect_terms *terms, const char **argv, int a
return res;
}
-static int get_first_good(const char *refname, const struct object_id *oid,
- int flag, void *cb_data)
+static int get_first_good(const char *UNUSED(refname),
+ const struct object_id *oid,
+ int UNUSED(flag), void *cb_data)
{
oidcpy(cb_data, oid);
return 1;
diff --git a/builtin/checkout.c b/builtin/checkout.c
index f9d63d8..713410c 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -990,7 +990,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
static int add_pending_uninteresting_ref(const char *refname,
const struct object_id *oid,
- int flags, void *cb_data)
+ int UNUSED(flags), void *cb_data)
{
add_pending_oid(cb_data, refname, oid, UNINTERESTING);
return 0;
diff --git a/builtin/describe.c b/builtin/describe.c
index a76f1a1..3af3648 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -140,7 +140,8 @@ static void add_to_known_names(const char *path,
}
}
-static int get_name(const char *path, const struct object_id *oid, int flag, void *cb_data)
+static int get_name(const char *path, const struct object_id *oid,
+ int UNUSED(flag), void *UNUSED(cb_data))
{
int is_tag = 0;
struct object_id peeled;
diff --git a/builtin/fetch.c b/builtin/fetch.c
index fc5cecb..9e7c809 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -329,7 +329,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
static int add_one_refname(const char *refname,
const struct object_id *oid,
- int flag, void *cbdata)
+ int UNUSED(flag), void *cbdata)
{
struct hashmap *refname_map = cbdata;
@@ -1462,8 +1462,9 @@ static void set_option(struct transport *transport, const char *name, const char
}
-static int add_oid(const char *refname, const struct object_id *oid, int flags,
- void *cb_data)
+static int add_oid(const char *UNUSED(refname),
+ const struct object_id *oid,
+ int UNUSED(flags), void *cb_data)
{
struct oid_array *oids = cb_data;
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 6c73092..36f1524 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -502,8 +502,9 @@ static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid
return 0;
}
-static int fsck_handle_reflog(const char *logname, const struct object_id *oid,
- int flag, void *cb_data)
+static int fsck_handle_reflog(const char *logname,
+ const struct object_id *UNUSED(oid),
+ int UNUSED(flag), void *cb_data)
{
struct strbuf refname = STRBUF_INIT;
@@ -514,7 +515,7 @@ static int fsck_handle_reflog(const char *logname, const struct object_id *oid,
}
static int fsck_handle_ref(const char *refname, const struct object_id *oid,
- int flag, void *cb_data)
+ int UNUSED(flag), void *UNUSED(cb_data))
{
struct object *obj;
diff --git a/builtin/gc.c b/builtin/gc.c
index eeff2b7..e4ede12 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -782,8 +782,9 @@ struct cg_auto_data {
int limit;
};
-static int dfs_on_ref(const char *refname,
- const struct object_id *oid, int flags,
+static int dfs_on_ref(const char *UNUSED(refname),
+ const struct object_id *oid,
+ int UNUSED(flags),
void *cb_data)
{
struct cg_auto_data *data = (struct cg_auto_data *)cb_data;
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 580b1eb..c4dc143 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -344,7 +344,8 @@ static int cmp_by_tag_and_age(const void *a_, const void *b_)
return a->taggerdate != b->taggerdate;
}
-static int name_ref(const char *path, const struct object_id *oid, int flags, void *cb_data)
+static int name_ref(const char *path, const struct object_id *oid,
+ int UNUSED(flags), void *cb_data)
{
struct object *o = parse_object(the_repository, oid);
struct name_ref_data *data = cb_data;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 39e28cf..eb93e5c 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -759,8 +759,8 @@ static enum write_one_status write_one(struct hashfile *f,
return WRITE_ONE_WRITTEN;
}
-static int mark_tagged(const char *path, const struct object_id *oid, int flag,
- void *cb_data)
+static int mark_tagged(const char *UNUSED(path), const struct object_id *oid,
+ int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id peeled;
struct object_entry *entry = packlist_find(&to_pack, oid);
@@ -3035,7 +3035,8 @@ static void add_tag_chain(const struct object_id *oid)
}
}
-static int add_ref_tag(const char *tag, const struct object_id *oid, int flag, void *cb_data)
+static int add_ref_tag(const char *UNUSED(tag), const struct object_id *oid,
+ int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id peeled;
@@ -3950,8 +3951,9 @@ static void record_recent_commit(struct commit *commit, void *data)
}
static int mark_bitmap_preferred_tip(const char *refname,
- const struct object_id *oid, int flags,
- void *_data)
+ const struct object_id *oid,
+ int UNUSED(flags),
+ void *UNUSED(data))
{
struct object_id peeled;
struct object *object;
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 31b48e7..afd36c9 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -291,7 +291,7 @@ static void show_ref(const char *path, const struct object_id *oid)
}
static int show_ref_cb(const char *path_full, const struct object_id *oid,
- int flag, void *data)
+ int UNUSED(flag), void *data)
{
struct oidset *seen = data;
const char *path = strip_namespace(path_full);
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 4dd297d..63f9a23 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -56,7 +56,8 @@ struct worktree_reflogs {
struct string_list reflogs;
};
-static int collect_reflog(const char *ref, const struct object_id *oid, int unused, void *cb_data)
+static int collect_reflog(const char *ref, const struct object_id *UNUSED(oid),
+ int UNUSED(flags), void *cb_data)
{
struct worktree_reflogs *cb = cb_data;
struct worktree *worktree = cb->worktree;
diff --git a/builtin/remote.c b/builtin/remote.c
index c713463..b390360 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -264,7 +264,8 @@ static const char *abbrev_ref(const char *name, const char *prefix)
}
#define abbrev_branch(name) abbrev_ref((name), "refs/heads/")
-static int config_read_branches(const char *key, const char *value, void *cb)
+static int config_read_branches(const char *key, const char *value,
+ void *UNUSED(data))
{
const char *orig_key = key;
char *name;
@@ -538,7 +539,8 @@ struct branches_for_remote {
};
static int add_branch_for_removal(const char *refname,
- const struct object_id *oid, int flags, void *cb_data)
+ const struct object_id *UNUSED(oid),
+ int UNUSED(flags), void *cb_data)
{
struct branches_for_remote *branches = cb_data;
struct refspec_item refspec;
@@ -580,7 +582,8 @@ struct rename_info {
};
static int read_remote_branches(const char *refname,
- const struct object_id *oid, int flags, void *cb_data)
+ const struct object_id *UNUSED(oid),
+ int UNUSED(flags), void *cb_data)
{
struct rename_info *rename = cb_data;
struct strbuf buf = STRBUF_INIT;
@@ -953,7 +956,8 @@ static void free_remote_ref_states(struct ref_states *states)
}
static int append_ref_to_tracked_list(const char *refname,
- const struct object_id *oid, int flags, void *cb_data)
+ const struct object_id *UNUSED(oid),
+ int flags, void *cb_data)
{
struct ref_states *states = cb_data;
struct refspec_item refspec;
diff --git a/builtin/repack.c b/builtin/repack.c
index 482b66f..ff952de 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -514,9 +514,9 @@ struct midx_snapshot_ref_data {
int preferred;
};
-static int midx_snapshot_ref_one(const char *refname,
+static int midx_snapshot_ref_one(const char *UNUSED(refname),
const struct object_id *oid,
- int flag, void *_data)
+ int UNUSED(flag), void *_data)
{
struct midx_snapshot_ref_data *data = _data;
struct object_id peeled;
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index b259d89..3c448d4 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -195,7 +195,8 @@ static int show_default(void)
return 0;
}
-static int show_reference(const char *refname, const struct object_id *oid, int flag, void *cb_data)
+static int show_reference(const char *refname, const struct object_id *oid,
+ int UNUSED(flag), void *UNUSED(cb_data))
{
if (ref_excluded(ref_excludes, refname))
return 0;
@@ -203,7 +204,8 @@ static int show_reference(const char *refname, const struct object_id *oid, int
return 0;
}
-static int anti_reference(const char *refname, const struct object_id *oid, int flag, void *cb_data)
+static int anti_reference(const char *refname, const struct object_id *oid,
+ int UNUSED(flag), void *UNUSED(cb_data))
{
show_rev(REVERSED, oid, refname);
return 0;
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 64c649c..3ec011b 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -404,7 +404,7 @@ static int append_ref(const char *refname, const struct object_id *oid,
}
static int append_head_ref(const char *refname, const struct object_id *oid,
- int flag, void *cb_data)
+ int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id tmp;
int ofs = 11;
@@ -419,7 +419,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,
}
static int append_remote_ref(const char *refname, const struct object_id *oid,
- int flag, void *cb_data)
+ int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id tmp;
int ofs = 13;
@@ -434,7 +434,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,
}
static int append_tag_ref(const char *refname, const struct object_id *oid,
- int flag, void *cb_data)
+ int UNUSED(flag), void *UNUSED(cb_data))
{
if (!starts_with(refname, "refs/tags/"))
return 0;
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 5fa207a..9746537 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -47,7 +47,7 @@ static void show_one(const char *refname, const struct object_id *oid)
}
static int show_ref(const char *refname, const struct object_id *oid,
- int flag, void *cbdata)
+ int UNUSED(flag), void *UNUSED(cbdata))
{
if (show_head && !strcmp(refname, "HEAD"))
goto match;
@@ -77,8 +77,9 @@ static int show_ref(const char *refname, const struct object_id *oid,
return 0;
}
-static int add_existing(const char *refname, const struct object_id *oid,
- int flag, void *cbdata)
+static int add_existing(const char *refname,
+ const struct object_id *UNUSED(oid),
+ int UNUSED(flag), void *cbdata)
{
struct string_list *list = (struct string_list *)cbdata;
string_list_insert(list, refname);
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index b63f420..e24e721 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -622,8 +622,9 @@ static void print_status(unsigned int flags, char state, const char *path,
printf("\n");
}
-static int handle_submodule_head_ref(const char *refname,
- const struct object_id *oid, int flags,
+static int handle_submodule_head_ref(const char *UNUSED(refname),
+ const struct object_id *oid,
+ int UNUSED(flags),
void *cb_data)
{
struct object_id *output = cb_data;