From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 13/21] for_each_object: mark unused callback parameters
Date: Fri, 24 Feb 2023 01:39:24 -0500 [thread overview]
Message-ID: <Y/hbnCJmo9G+YqE6@coredump.intra.peff.net> (raw)
In-Reply-To: <Y/habYJxDRJQg/kJ@coredump.intra.peff.net>
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 <peff@peff.net>
---
builtin/cat-file.c | 8 ++++----
builtin/count-objects.c | 6 ++++--
builtin/fsck.c | 25 +++++++++++++------------
builtin/gc.c | 14 +++++++-------
builtin/pack-objects.c | 15 ++++++++-------
builtin/prune.c | 6 ++++--
builtin/repack.c | 5 +++--
builtin/rev-list.c | 3 ++-
diagnose.c | 3 ++-
midx.c | 2 +-
object-file.c | 3 ++-
packfile.c | 4 ++--
reachable.c | 3 ++-
revision.c | 4 ++--
14 files changed, 56 insertions(+), 45 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index cc17635e76..0dec21c107 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -559,16 +559,16 @@ static int batch_object_cb(const struct object_id *oid, void *vdata)
}
static int collect_loose_object(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
oid_array_append(data, oid);
return 0;
}
static int collect_packed_object(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
void *data)
{
oid_array_append(data, oid);
@@ -591,7 +591,7 @@ static int batch_unordered_object(const struct object_id *oid,
}
static int batch_unordered_loose(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
return batch_unordered_object(oid, NULL, 0, data);
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 07b9419596..bb21bc43e4 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -57,7 +57,8 @@ static void loose_garbage(const char *path)
report_garbage(PACKDIR_FILE_GARBAGE, path);
}
-static int count_loose(const struct object_id *oid, const char *path, void *data)
+static int count_loose(const struct object_id *oid, const char *path,
+ void *data UNUSED)
{
struct stat st;
@@ -72,7 +73,8 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
return 0;
}
-static int count_cruft(const char *basename, const char *path, void *data)
+static int count_cruft(const char *basename UNUSED, const char *path,
+ void *data UNUSED)
{
loose_garbage(path);
return 0;
diff --git a/builtin/fsck.c b/builtin/fsck.c
index d207bd909b..56aba054ed 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -233,17 +233,17 @@ static void mark_unreachable_referents(const struct object_id *oid)
}
static int mark_loose_unreachable_referents(const struct object_id *oid,
- const char *path,
- void *data)
+ const char *path UNUSED,
+ void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
}
static int mark_packed_unreachable_referents(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
- void *data)
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
+ void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
@@ -661,14 +661,15 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
return 0; /* keep checking other objects, even if we saw an error */
}
-static int fsck_cruft(const char *basename, const char *path, void *data)
+static int fsck_cruft(const char *basename, const char *path,
+ void *data UNUSED)
{
if (!starts_with(basename, "tmp_obj_"))
fprintf_ln(stderr, _("bad sha1 file: %s"), path);
return 0;
}
-static int fsck_subdir(unsigned int nr, const char *path, void *data)
+static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)
{
struct for_each_loose_cb *cb_data = data;
struct progress *progress = cb_data->progress;
@@ -803,17 +804,17 @@ static void mark_object_for_connectivity(const struct object_id *oid)
}
static int mark_loose_for_connectivity(const struct object_id *oid,
- const char *path,
- void *data)
+ const char *path UNUSED,
+ void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;
}
static int mark_packed_for_connectivity(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
- void *data)
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
+ void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;
diff --git a/builtin/gc.c b/builtin/gc.c
index 02455fdcd7..4486438624 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -976,9 +976,9 @@ struct write_loose_object_data {
static int loose_object_auto_limit = 100;
-static int loose_object_count(const struct object_id *oid,
- const char *path,
- void *data)
+static int loose_object_count(const struct object_id *oid UNUSED,
+ const char *path UNUSED,
+ void *data)
{
int *count = (int*)data;
if (++(*count) >= loose_object_auto_limit)
@@ -1003,15 +1003,15 @@ static int loose_object_auto_condition(void)
NULL, NULL, &count);
}
-static int bail_on_loose(const struct object_id *oid,
- const char *path,
- void *data)
+static int bail_on_loose(const struct object_id *oid UNUSED,
+ const char *path UNUSED,
+ void *data UNUSED)
{
return 1;
}
static int write_loose_object_to_stdin(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
struct write_loose_object_data *d = (struct write_loose_object_data *)data;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index fb92a9686b..d7eebeb6eb 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -3260,13 +3260,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,
return 0;
}
-static void show_commit_pack_hint(struct commit *commit, void *_data)
+static void show_commit_pack_hint(struct commit *commit UNUSED,
+ void *data UNUSED)
{
/* nothing to do; commits don't have a namehash */
}
static void show_object_pack_hint(struct object *object, const char *name,
- void *_data)
+ void *data UNUSED)
{
struct object_entry *oe = packlist_find(&to_pack, &object->oid);
if (!oe)
@@ -3762,7 +3763,7 @@ static void show_edge(struct commit *commit)
static int add_object_in_unpacked_pack(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
- void *_data)
+ void *data UNUSED)
{
if (cruft) {
off_t offset;
@@ -3796,7 +3797,7 @@ static void add_objects_in_unpacked_packs(void)
}
static int add_loose_object(const struct object_id *oid, const char *path,
- void *data)
+ void *data UNUSED)
{
enum object_type type = oid_object_info(the_repository, oid, NULL);
@@ -3947,13 +3948,13 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
}
static void record_recent_object(struct object *obj,
- const char *name,
- void *data)
+ const char *name UNUSED,
+ void *data UNUSED)
{
oid_array_append(&recent_objects, &obj->oid);
}
-static void record_recent_commit(struct commit *commit, void *data)
+static void record_recent_commit(struct commit *commit, void *data UNUSED)
{
oid_array_append(&recent_objects, &commit->object.oid);
}
diff --git a/builtin/prune.c b/builtin/prune.c
index 2719220108..4580890393 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -98,7 +98,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
return 0;
}
-static int prune_cruft(const char *basename, const char *path, void *data)
+static int prune_cruft(const char *basename, const char *path,
+ void *data UNUSED)
{
if (starts_with(basename, "tmp_obj_"))
prune_tmp_file(path);
@@ -107,7 +108,8 @@ static int prune_cruft(const char *basename, const char *path, void *data)
return 0;
}
-static int prune_subdir(unsigned int nr, const char *path, void *data)
+static int prune_subdir(unsigned int nr UNUSED, const char *path,
+ void *data UNUSED)
{
if (!show_only)
rmdir(path);
diff --git a/builtin/repack.c b/builtin/repack.c
index f649379531..36b511c564 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -182,8 +182,9 @@ static void prepare_pack_objects(struct child_process *cmd,
* Write oid to the given struct child_process's stdin, starting it first if
* necessary.
*/
-static int write_oid(const struct object_id *oid, struct packed_git *pack,
- uint32_t pos, void *data)
+static int write_oid(const struct object_id *oid,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED, void *data)
{
struct child_process *cmd = data;
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index cceb5de975..888ad6b5c0 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -257,7 +257,8 @@ static inline void finish_object__ma(struct object *obj)
}
}
-static int finish_object(struct object *obj, const char *name, void *cb_data)
+static int finish_object(struct object *obj, const char *name UNUSED,
+ void *cb_data)
{
struct rev_list_info *info = cb_data;
if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
diff --git a/diagnose.c b/diagnose.c
index 8f26569896..e7c42b3a71 100644
--- a/diagnose.c
+++ b/diagnose.c
@@ -43,7 +43,8 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset)
return error(_("invalid --%s value '%s'"), opt->long_name, arg);
}
-static void dir_file_stats_objects(const char *full_path, size_t full_path_len,
+static void dir_file_stats_objects(const char *full_path,
+ size_t full_path_len UNUSED,
const char *file_name, void *data)
{
struct strbuf *buf = data;
diff --git a/midx.c b/midx.c
index 7cfad04a24..d761cc50bd 100644
--- a/midx.c
+++ b/midx.c
@@ -1607,7 +1607,7 @@ struct clear_midx_data {
const char *ext;
};
-static void clear_midx_file_ext(const char *full_path, size_t full_path_len,
+static void clear_midx_file_ext(const char *full_path, size_t full_path_len UNUSED,
const char *file_name, void *_data)
{
struct clear_midx_data *data = _data;
diff --git a/object-file.c b/object-file.c
index 939865c1ae..389d452e48 100644
--- a/object-file.c
+++ b/object-file.c
@@ -2644,7 +2644,8 @@ int for_each_loose_object(each_loose_object_fn cb, void *data,
return 0;
}
-static int append_loose_object(const struct object_id *oid, const char *path,
+static int append_loose_object(const struct object_id *oid,
+ const char *path UNUSED,
void *data)
{
oidtree_insert(data, oid);
diff --git a/packfile.c b/packfile.c
index 79e21ab18e..4dc0e15aa5 100644
--- a/packfile.c
+++ b/packfile.c
@@ -2204,8 +2204,8 @@ int for_each_packed_object(each_packed_object_fn cb, void *data,
}
static int add_promisor_object(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
void *set_)
{
struct oidset *set = set_;
diff --git a/reachable.c b/reachable.c
index 08f290c2be..0afe80c203 100644
--- a/reachable.c
+++ b/reachable.c
@@ -154,7 +154,8 @@ static int add_recent_loose(const struct object_id *oid,
}
static int add_recent_packed(const struct object_id *oid,
- struct packed_git *p, uint32_t pos,
+ struct packed_git *p,
+ uint32_t pos,
void *data)
{
struct object *obj;
diff --git a/revision.c b/revision.c
index 4a24fc3fcd..65fca1ed6c 100644
--- a/revision.c
+++ b/revision.c
@@ -3440,8 +3440,8 @@ void reset_revision_walk(void)
}
static int mark_uninteresting(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
void *cb)
{
struct rev_info *revs = cb;
--
2.39.2.981.g6157336f25
next prev parent reply other threads:[~2023-02-24 6:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 6:34 [PATCH 0/21] more -Wunused-parameter fixes Jeff King
2023-02-24 6:34 ` [PATCH 01/21] ref-filter: drop unused atom parameter from get_worktree_path() Jeff King
2023-02-24 17:53 ` Junio C Hamano
2023-02-24 6:37 ` [PATCH 02/21] ls-refs: drop config caching Jeff King
2023-02-24 6:38 ` [PATCH 03/21] serve: use repository pointer to get config Jeff King
2023-02-24 17:59 ` Junio C Hamano
2023-02-24 6:38 ` [PATCH 04/21] serve: mark unused parameters in virtual functions Jeff King
2023-02-24 6:38 ` [PATCH 05/21] object-name: mark unused parameters in disambiguate callbacks Jeff King
2023-02-24 6:38 ` [PATCH 06/21] http-backend: mark argc/argv unused Jeff King
2023-02-24 6:38 ` [PATCH 07/21] http-backend: mark unused parameters in virtual functions Jeff King
2023-02-24 6:39 ` [PATCH 08/21] ref-filter: mark unused callback parameters Jeff King
2023-02-24 6:39 ` [PATCH 09/21] mark "pointless" data pointers in callbacks Jeff King
2023-02-24 6:39 ` [PATCH 10/21] run-command: mark error routine parameters as unused Jeff King
2023-02-24 6:39 ` [PATCH 11/21] mark unused parameters in signal handlers Jeff King
2023-02-24 6:39 ` [PATCH 12/21] list-objects: mark unused callback parameters Jeff King
2023-02-24 6:39 ` Jeff King [this message]
2023-02-24 6:39 ` [PATCH 14/21] prio-queue: mark unused parameters in comparison functions Jeff King
2023-02-24 6:39 ` [PATCH 15/21] notes: mark unused callback parameters Jeff King
2023-02-24 6:39 ` [PATCH 16/21] fetch-pack: mark unused parameter in callback function Jeff King
2023-02-24 6:39 ` [PATCH 17/21] rewrite_parents(): mark unused callback parameter Jeff King
2023-02-24 6:39 ` [PATCH 18/21] for_each_commit_graft(): " Jeff King
2023-02-24 6:39 ` [PATCH 19/21] userformat_want_item(): mark unused parameter Jeff King
2023-02-24 6:39 ` [PATCH 20/21] run_processes_parallel: mark unused callback parameters Jeff King
2023-02-24 6:39 ` [PATCH 21/21] help: mark unused parameter in git_unknown_cmd_config() Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/hbnCJmo9G+YqE6@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).