File gcc15-fixes2.patch of Package renameutils
Author: Francois Marier <francois@debian.org>
Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1114344
Description: Fix FTBFS
Last-Updated: 2025-09-07
--- a/src/common/tmap.h
+++ b/src/common/tmap.h
@@ -51,8 +51,8 @@ void *tmap_remove(TMap *map, const void *key);
void tmap_iterator(TMap *map, TMapIterator *it); /* value iterator */
bool tmap_iterator_partial(TMap *map, TMapIterator *it, const void *match, comparison_fn_t comparator);
void tmap_clear(TMap *map);
-void tmap_foreach_key(TMap *map, void (*iterator)());
-void tmap_foreach_value(TMap *map, void (*iterator)());
+void tmap_foreach_key(TMap *map, void (*iterator)(void *));
+void tmap_foreach_value(TMap *map, void (*iterator)(void *));
#ifdef ENABLE_TMAP_TESTING
#include <stdio.h>
diff --git a/src/common/tmap.c b/src/common/tmap.c
index afa2203..9230969 100644
--- a/src/common/tmap.c
+++ b/src/common/tmap.c
@@ -507,7 +507,7 @@ predecessor(TMapNode *node)
#endif
static void
-tmap_foreach_nodes_key(TMapNode *node, void (*iterator)())
+tmap_foreach_nodes_key(TMapNode *node, void (*iterator)(void *))
{
if (node->left != &nil)
tmap_foreach_nodes_key(node->left, iterator);
@@ -517,7 +517,7 @@ tmap_foreach_nodes_key(TMapNode *node, void (*iterator)())
}
static void
-tmap_foreach_nodes_value(TMapNode *node, void (*iterator)())
+tmap_foreach_nodes_value(TMapNode *node, void (*iterator)(void *))
{
if (node->left != &nil)
tmap_foreach_nodes_value(node->left, iterator);
@@ -527,14 +527,14 @@ tmap_foreach_nodes_value(TMapNode *node, void (*iterator)())
}
void
-tmap_foreach_key(TMap *map, void (*iterator)())
+tmap_foreach_key(TMap *map, void (*iterator)(void *))
{
if (map->root != &nil)
tmap_foreach_nodes_key(map->root, iterator);
}
void
-tmap_foreach_value(TMap *map, void (*iterator)())
+tmap_foreach_value(TMap *map, void (*iterator)(void *))
{
if (map->root != &nil)
tmap_foreach_nodes_value(map->root, iterator);
diff --git a/src/common/hmap.h b/src/common/hmap.h
index bf6684b..0ca0b56 100644
--- a/src/common/hmap.h
+++ b/src/common/hmap.h
@@ -50,8 +50,8 @@ void *hmap_put(HMap *map, void *key, void *value);
bool hmap_contains_key(HMap *map, const void *key);
void *hmap_remove(HMap *map, const void *key);
void hmap_iterator(HMap *map, HMapIterator *it);
-void hmap_foreach_key(HMap *map, void (*iterator)());
-void hmap_foreach_value(HMap *map, void (*iterator)());
+void hmap_foreach_key(HMap *map, void (*iterator)(void*));
+void hmap_foreach_value(HMap *map, void (*iterator)(void*));
void hmap_clear(HMap *map);
size_t hmap_size(HMap *map);
void hmap_set_hash_fn(HMap *map, hash_fn_t hash);
diff --git a/src/common/llist.h b/src/common/llist.h
index 11d13a3..c22cce9 100644
--- a/src/common/llist.h
+++ b/src/common/llist.h
@@ -68,7 +68,7 @@ LList *llist_clone(LList *list);
void **llist_to_array(LList *list);
void **llist_to_null_terminated_array(LList *list);
-void llist_iterate(LList *list, void (*iterator_func)());
+void llist_iterate(LList *list, void (*iterator_func)(void*));
void llist_iterator(LList *list, LListIterator *it);
void llist_reverse(LList *list);
diff --git a/src/list.c b/src/list.c
index d5bac13..fb5abfb 100644
--- a/src/list.c
+++ b/src/list.c
@@ -166,14 +166,14 @@ import_command(char **args)
hmap_free(map_files);
if (ferror(fh)) {
warn(_("%s: cannot read from file: %s\n"), quotearg(args[1]), errstr);
- llist_iterate(new_files, free_file_spec);
+ llist_iterate(new_files, free_file_spec_wrapper);
llist_free(new_files);
fclose(fh);
return;
}
fclose(fh);
- llist_iterate(work_files, free_file_spec);
+ llist_iterate(work_files, free_file_spec_wrapper);
llist_free(work_files);
work_files = new_files;
}
@@ -370,7 +370,7 @@ list_files(char **args)
free_plan(plan);
plan = NULL;
}
- llist_iterate(work_files, free_file_spec);
+ llist_iterate(work_files, free_file_spec_wrapper);
llist_clear(work_files);
if (!process_ls_output(firstdir, work_files, ls_fd)) {
@@ -567,6 +567,13 @@ free_file_spec(FileSpec *spec)
free(spec);
}
+/* Wrapper function to make free_file_spec compatible with llist_iterate */
+void
+free_file_spec_wrapper(void *spec)
+{
+ free_file_spec((FileSpec *)spec);
+}
+
void
dump_spec_list(LList *list)
{
diff --git a/src/qcmd.c b/src/qcmd.c
index 285fe8e..7e1d349 100644
--- a/src/qcmd.c
+++ b/src/qcmd.c
@@ -263,7 +263,7 @@ main(int argc, char **argv)
free_plan(plan);
/*dump_spec_list(work_files);*/
- llist_iterate(work_files, free_file_spec);
+ llist_iterate(work_files, free_file_spec_wrapper);
llist_free(work_files);
free(all_options);
free(editor_program);
diff --git a/src/qcmd.h b/src/qcmd.h
index f77bdcc..81c6b94 100644
--- a/src/qcmd.h
+++ b/src/qcmd.h
@@ -94,6 +94,7 @@ void process_ls_option(int c);
struct option *append_ls_options(const struct option *options);
FileSpec *new_file_spec(void);
void free_file_spec(FileSpec *spec);
+void free_file_spec_wrapper(void *spec);
void free_files(LList *files);
void display_ls_help(FILE *out);
bool cwd_to_work_directory();