string-list: mark unused callback parameters

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 17, 2022 at 21:05 UTC 1ee347104576c8a2681edd79ed8328791f0677d2
7 files changed +8 -7
archive.c
+1 -1
@@ -500,7 +500,7 @@ static void parse_treeish_arg(const char **argv,
500 ar_args->time = archive_time;
501 }
502
503 -static void extra_file_info_clear(void *util, const char *str)
503 +static void extra_file_info_clear(void *util, const char *str UNUSED)
504 {
505 struct extra_file_info *info = util;
506 free(info->base);
builtin/gc.c
+1 -1
@@ -329,7 +329,7 @@ static uint64_t estimate_repack_memory(struct packed_git *pack)
329 return os_cache + heap;
330 }
331
332 -static int keep_one_pack(struct string_list_item *item, void *data)
332 +static int keep_one_pack(struct string_list_item *item, void *data UNUSED)
333 {
334 strvec_pushf(&repack, "--keep-pack=%s", basename(item->string));
335 return 0;
builtin/remote.c
+1 -1
@@ -940,7 +940,7 @@ static int rm(int argc, const char **argv, const char *prefix)
940 return result;
941 }
942
943 -static void clear_push_info(void *util, const char *string)
943 +static void clear_push_info(void *util, const char *string UNUSED)
944 {
945 struct push_info *info = util;
946 free(info->dest);
merge-ort.c
+1 -1
@@ -397,7 +397,7 @@ struct conflicted_submodule_item {
397 int flag;
398 };
399
400 -static void conflicted_submodule_item_free(void *util, const char *str)
400 +static void conflicted_submodule_item_free(void *util, const char *str UNUSED)
401 {
402 struct conflicted_submodule_item *item = util;
403
reflog-walk.c
+1 -1
@@ -55,7 +55,7 @@ static void free_complete_reflog(struct complete_reflogs *array)
55 free(array);
56 }
57
58 -static void complete_reflogs_clear(void *util, const char *str)
58 +static void complete_reflogs_clear(void *util, const char *str UNUSED)
59 {
60 struct complete_reflogs *array = util;
61 free_complete_reflog(array);
string-list.c
+1 -1
@@ -156,7 +156,7 @@ void filter_string_list(struct string_list *list, int free_util,
156 list->nr = dst;
157 }
158
159 -static int item_is_not_empty(struct string_list_item *item, void *unused)
159 +static int item_is_not_empty(struct string_list_item *item, void *data UNUSED)
160 {
161 return *item->string != '\0';
162 }
t/helper/test-path-utils.c
+2 -1
@@ -8,7 +8,8 @@
8 * GIT_CEILING_DIRECTORIES. If the path is unusable for some reason,
9 * die with an explanation.
10 */
11 -static int normalize_ceiling_entry(struct string_list_item *item, void *unused)
11 +static int normalize_ceiling_entry(struct string_list_item *item,
12 + void *data UNUSED)
13 {
14 char *ceil = item->string;
15