Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 07/14] revisions: drop unused "opt" parameter in "tweak" callbacks
Date: Mon, 3 Jul 2023 02:44:16 -0400	[thread overview]
Message-ID: <20230703064416.GG3537614@coredump.intra.peff.net> (raw)
In-Reply-To: <20230703064347.GA3524892@coredump.intra.peff.net>

The setup_revision_opt struct has a "tweak" function pointer, which can
be used to adjust parameters after setup_revisions() parses arguments,
but before it finalizes setup. In addition to the rev_info struct, the
callback receives a pointer to the setup_revision_opt, as well.

But none of the existing callbacks looks at the extra "opt" parameter,
leading to -Wunused-parameter warnings.

We could mark it as UNUSED, but instead let's remove it entirely. It's
conceivable that it could be useful for a callback to have access to the
"opt" struct. But in the 13 years that this mechanism has existed,
nobody has used it. So let's just drop it in the name of simplifying.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/diff-tree.c | 2 +-
 builtin/log.c       | 6 ++----
 revision.c          | 2 +-
 revision.h          | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index d62caa6c8b..c9ba35f143 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -99,7 +99,7 @@ static const char diff_tree_usage[] =
 "  --root        include the initial commit as diff against /dev/null\n"
 COMMON_DIFF_OPTIONS_HELP;
 
-static void diff_tree_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt)
+static void diff_tree_tweak_rev(struct rev_info *rev)
 {
 	if (!rev->diffopt.output_format) {
 		if (rev->dense_combined_merges)
diff --git a/builtin/log.c b/builtin/log.c
index 89442dceda..91bc7d967e 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -718,8 +718,7 @@ static int show_tree_object(const struct object_id *oid UNUSED,
 	return 0;
 }
 
-static void show_setup_revisions_tweak(struct rev_info *rev,
-				       struct setup_revision_opt *opt)
+static void show_setup_revisions_tweak(struct rev_info *rev)
 {
 	if (rev->first_parent_only)
 		diff_merges_default_to_first_parent(rev);
@@ -862,8 +861,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
 	return cmd_log_deinit(cmd_log_walk(&rev), &rev);
 }
 
-static void log_setup_revisions_tweak(struct rev_info *rev,
-				      struct setup_revision_opt *opt)
+static void log_setup_revisions_tweak(struct rev_info *rev)
 {
 	if (rev->diffopt.flags.default_follow_renames &&
 	    diff_check_follow_pathspec(&rev->prune_data, 0))
diff --git a/revision.c b/revision.c
index 84768565ce..73f8c7e2e0 100644
--- a/revision.c
+++ b/revision.c
@@ -2955,7 +2955,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 	if (!revs->def)
 		revs->def = opt ? opt->def : NULL;
 	if (opt && opt->tweak)
-		opt->tweak(revs, opt);
+		opt->tweak(revs);
 	if (revs->show_merge)
 		prepare_show_merge(revs);
 	if (revs->def && !revs->pending.nr && !revs->rev_input_given) {
diff --git a/revision.h b/revision.h
index 25776af381..18f49565c2 100644
--- a/revision.h
+++ b/revision.h
@@ -428,7 +428,7 @@ void repo_init_revisions(struct repository *r,
  */
 struct setup_revision_opt {
 	const char *def;
-	void (*tweak)(struct rev_info *, struct setup_revision_opt *);
+	void (*tweak)(struct rev_info *);
 	unsigned int	assume_dashdash:1,
 			allow_exclude_promisor_objects:1,
 			free_removed_argv_elements:1;
-- 
2.41.0.586.g3c0cc15bc7


  parent reply	other threads:[~2023-07-03  6:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03  6:43 [PATCH 0/14] more -Wunused-parameter annotations Jeff King
2023-07-03  6:43 ` [PATCH 01/14] test-ref-store: drop unimplemented reflog-expire command Jeff King
2023-07-03  6:44 ` [PATCH 02/14] do_for_each_ref_helper(): mark unused repository parameter Jeff King
2023-07-03  6:44 ` [PATCH 03/14] http: mark unused parameters in curl callbacks Jeff King
2023-07-03  6:44 ` [PATCH 04/14] http-push: mark unused parameter in xml callback Jeff King
2023-07-03  6:44 ` [PATCH 05/14] am: mark unused keep_cr parameters Jeff King
2023-07-03  6:44 ` [PATCH 06/14] count-objects: mark unused parameter in alternates callback Jeff King
2023-07-03  6:44 ` Jeff King [this message]
2023-07-03  6:44 ` [PATCH 08/14] fsck: mark unused parameters in various fsck callbacks Jeff King
2023-07-03  6:44 ` [PATCH 09/14] merge-tree: mark unused parameter in traverse callback Jeff King
2023-07-03  6:44 ` [PATCH 10/14] replace: mark unused parameter in ref callback Jeff King
2023-07-03  6:44 ` [PATCH 11/14] replace: mark unused parameter in each_mergetag_fn callback Jeff King
2023-07-03  6:44 ` [PATCH 12/14] rev-parse: mark unused parameter in for_each_abbrev callback Jeff King
2023-07-03  6:44 ` [PATCH 13/14] tag: mark unused parameters in each_tag_name_fn callbacks Jeff King
2023-07-03  6:44 ` [PATCH 14/14] t/helper: mark unused callback void data parameters 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230703064416.GG3537614@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.
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).