Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 06/12] string-list: mark unused callback parameters
Date: Mon, 17 Oct 2022 21:05:32 -0400	[thread overview]
Message-ID: <Y0373IoJfIkb0QIP@coredump.intra.peff.net> (raw)
In-Reply-To: <Y036whEorZV0rOgB@coredump.intra.peff.net>

String-lists may be used with callbacks for clearing or iteration. These
callbacks need to conform to a particular interface, even though not
every callback needs all of its parameters. Mark the unused ones to make
-Wunused-parameter happy.

Signed-off-by: Jeff King <peff@peff.net>
---
 archive.c                  | 2 +-
 builtin/gc.c               | 2 +-
 builtin/remote.c           | 2 +-
 merge-ort.c                | 2 +-
 reflog-walk.c              | 2 +-
 string-list.c              | 2 +-
 t/helper/test-path-utils.c | 3 ++-
 7 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/archive.c b/archive.c
index 61a79e4a22..16f85e5475 100644
--- a/archive.c
+++ b/archive.c
@@ -500,7 +500,7 @@ static void parse_treeish_arg(const char **argv,
 	ar_args->time = archive_time;
 }
 
-static void extra_file_info_clear(void *util, const char *str)
+static void extra_file_info_clear(void *util, const char *str UNUSED)
 {
 	struct extra_file_info *info = util;
 	free(info->base);
diff --git a/builtin/gc.c b/builtin/gc.c
index 243ee85d28..24ea85c7af 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -322,7 +322,7 @@ static uint64_t estimate_repack_memory(struct packed_git *pack)
 	return os_cache + heap;
 }
 
-static int keep_one_pack(struct string_list_item *item, void *data)
+static int keep_one_pack(struct string_list_item *item, void *data UNUSED)
 {
 	strvec_pushf(&repack, "--keep-pack=%s", basename(item->string));
 	return 0;
diff --git a/builtin/remote.c b/builtin/remote.c
index 910f7b9316..93285fc06e 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -942,7 +942,7 @@ static int rm(int argc, const char **argv, const char *prefix)
 	return result;
 }
 
-static void clear_push_info(void *util, const char *string)
+static void clear_push_info(void *util, const char *string UNUSED)
 {
 	struct push_info *info = util;
 	free(info->dest);
diff --git a/merge-ort.c b/merge-ort.c
index e5f41cce48..7e83ebfaa9 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -397,7 +397,7 @@ struct conflicted_submodule_item {
 	int flag;
 };
 
-static void conflicted_submodule_item_free(void *util, const char *str)
+static void conflicted_submodule_item_free(void *util, const char *str UNUSED)
 {
 	struct conflicted_submodule_item *item = util;
 
diff --git a/reflog-walk.c b/reflog-walk.c
index 7aa6595a51..8a4d8fa3bd 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -55,7 +55,7 @@ static void free_complete_reflog(struct complete_reflogs *array)
 	free(array);
 }
 
-static void complete_reflogs_clear(void *util, const char *str)
+static void complete_reflogs_clear(void *util, const char *str UNUSED)
 {
 	struct complete_reflogs *array = util;
 	free_complete_reflog(array);
diff --git a/string-list.c b/string-list.c
index 549fc416d6..42bacaec55 100644
--- a/string-list.c
+++ b/string-list.c
@@ -156,7 +156,7 @@ void filter_string_list(struct string_list *list, int free_util,
 	list->nr = dst;
 }
 
-static int item_is_not_empty(struct string_list_item *item, void *unused)
+static int item_is_not_empty(struct string_list_item *item, void *data UNUSED)
 {
 	return *item->string != '\0';
 }
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index d20e1b7a18..f69709d674 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -8,7 +8,8 @@
  * GIT_CEILING_DIRECTORIES.  If the path is unusable for some reason,
  * die with an explanation.
  */
-static int normalize_ceiling_entry(struct string_list_item *item, void *unused)
+static int normalize_ceiling_entry(struct string_list_item *item,
+				   void *data UNUSED)
 {
 	char *ceil = item->string;
 
-- 
2.38.0.371.g300879f34e


  parent reply	other threads:[~2022-10-18  1:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  1:00 [PATCH 0/12] more unused-parameter fixes / annotations Jeff King
2022-10-18  1:01 ` [PATCH 01/12] diffstat_consume(): assert non-zero length Jeff King
2022-10-18  1:02 ` [PATCH 02/12] submodule--helper: drop unused argc from module_list_compute() Jeff King
2022-10-18  1:04 ` [PATCH 03/12] update-index: drop unused argc from do_reupdate() Jeff King
2022-10-18  1:05 ` [PATCH 04/12] mark unused parameters in trivial compat functions Jeff King
2022-10-18  1:05 ` [PATCH 05/12] object-file: mark unused parameters in hash_unknown functions Jeff King
2022-10-18  1:05 ` Jeff King [this message]
2022-10-18  1:05 ` [PATCH 07/12] date: mark unused parameters in handler functions Jeff King
2022-10-18  1:08 ` [PATCH 08/12] apply: mark unused parameters in handlers Jeff King
2022-10-18  1:08 ` [PATCH 09/12] apply: mark unused parameters in noop error/warning routine Jeff King
2022-10-18  1:08 ` [PATCH 10/12] convert: mark unused parameter in null stream filter Jeff King
2022-10-18  1:09 ` [PATCH 11/12] diffcore-pickaxe: mark unused parameters in pickaxe functions Jeff King
2022-10-18  1:10 ` [PATCH 12/12] ll-merge: mark unused parameters in callbacks 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=Y0373IoJfIkb0QIP@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).