Merge branch 'jk/unused-post-2.40'

More "-Wunused-parameters" code clean-up.

* jk/unused-post-2.40:
  transport: mark unused parameters in fetch_refs_from_bundle()
  http: mark unused parameter in fill_active_slot() callbacks
  http: drop unused parameter from start_object_request()
  mailmap: drop debugging code
This commit is contained in:
Junio C Hamano 2023-04-06 13:38:28 -07:00
Родитель ae61aecb9e b3edf335df
Коммит 9bc647a2d1
4 изменённых файлов: 11 добавлений и 47 удалений

Просмотреть файл

@ -602,7 +602,7 @@ static void finish_request(struct transfer_request *request)
}
static int is_running_queue;
static int fill_active_slot(void *unused)
static int fill_active_slot(void *data UNUSED)
{
struct transfer_request *request;

Просмотреть файл

@ -53,8 +53,7 @@ static void fetch_alternates(struct walker *walker, const char *base);
static void process_object_response(void *callback_data);
static void start_object_request(struct walker *walker,
struct object_request *obj_req)
static void start_object_request(struct object_request *obj_req)
{
struct active_request_slot *slot;
struct http_object_request *req;
@ -111,7 +110,7 @@ static void process_object_response(void *callback_data)
obj_req->repo =
obj_req->repo->next;
release_http_object_request(obj_req->req);
start_object_request(walker, obj_req);
start_object_request(obj_req);
return;
}
}
@ -128,7 +127,7 @@ static void release_object_request(struct object_request *obj_req)
free(obj_req);
}
static int fill_active_slot(struct walker *walker)
static int fill_active_slot(void *data UNUSED)
{
struct object_request *obj_req;
struct list_head *pos, *tmp, *head = &object_queue_head;
@ -139,7 +138,7 @@ static int fill_active_slot(struct walker *walker)
if (has_object_file(&obj_req->oid))
obj_req->state = COMPLETE;
else {
start_object_request(walker, obj_req);
start_object_request(obj_req);
return 1;
}
}
@ -614,7 +613,7 @@ struct walker *get_http_walker(const char *url)
walker->cleanup = cleanup;
walker->data = data;
add_fill_function(walker, (int (*)(void *)) fill_active_slot);
add_fill_function(NULL, fill_active_slot);
return walker;
}

Просмотреть файл

@ -3,16 +3,6 @@
#include "mailmap.h"
#include "object-store.h"
#define DEBUG_MAILMAP 0
#if DEBUG_MAILMAP
#define debug_mm(...) fprintf(stderr, __VA_ARGS__)
#define debug_str(X) ((X) ? (X) : "(none)")
#else
__attribute__((format (printf, 1, 2)))
static inline void debug_mm(const char *format, ...) {}
static inline const char *debug_str(const char *s) { return s; }
#endif
const char *git_mailmap_file;
const char *git_mailmap_blob;
@ -30,23 +20,17 @@ struct mailmap_entry {
struct string_list namemap;
};
static void free_mailmap_info(void *p, const char *s)
static void free_mailmap_info(void *p, const char *s UNUSED)
{
struct mailmap_info *mi = (struct mailmap_info *)p;
debug_mm("mailmap: -- complex: '%s' -> '%s' <%s>\n",
s, debug_str(mi->name), debug_str(mi->email));
free(mi->name);
free(mi->email);
free(mi);
}
static void free_mailmap_entry(void *p, const char *s)
static void free_mailmap_entry(void *p, const char *s UNUSED)
{
struct mailmap_entry *me = (struct mailmap_entry *)p;
debug_mm("mailmap: removing entries for <%s>, with %"PRIuMAX" sub-entries\n",
s, (uintmax_t)me->namemap.nr);
debug_mm("mailmap: - simple: '%s' <%s>\n",
debug_str(me->name), debug_str(me->email));
free(me->name);
free(me->email);
@ -93,8 +77,6 @@ static void add_mapping(struct string_list *map,
}
if (!old_name) {
debug_mm("mailmap: adding (simple) entry for '%s'\n", old_email);
/* Replace current name and new email for simple entry */
if (new_name) {
free(me->name);
@ -106,15 +88,10 @@ static void add_mapping(struct string_list *map,
}
} else {
struct mailmap_info *mi = xcalloc(1, sizeof(struct mailmap_info));
debug_mm("mailmap: adding (complex) entry for '%s'\n", old_email);
mi->name = xstrdup_or_null(new_name);
mi->email = xstrdup_or_null(new_email);
string_list_insert(&me->namemap, old_name)->util = mi;
}
debug_mm("mailmap: '%s' <%s> -> '%s' <%s>\n",
debug_str(old_name), old_email,
debug_str(new_name), debug_str(new_email));
}
static char *parse_name_and_email(char *buffer, char **name,
@ -250,11 +227,8 @@ int read_mailmap(struct string_list *map)
void clear_mailmap(struct string_list *map)
{
debug_mm("mailmap: clearing %"PRIuMAX" entries...\n",
(uintmax_t)map->nr);
map->strdup_strings = 1;
string_list_clear_func(map, free_mailmap_entry);
debug_mm("mailmap: cleared\n");
}
/*
@ -315,10 +289,6 @@ int map_user(struct string_list *map,
struct string_list_item *item;
struct mailmap_entry *me;
debug_mm("map_user: map '%.*s' <%.*s>\n",
(int)*namelen, debug_str(*name),
(int)*emaillen, debug_str(*email));
item = lookup_prefix(map, *email, *emaillen);
if (item) {
me = (struct mailmap_entry *)item->util;
@ -336,10 +306,8 @@ int map_user(struct string_list *map,
}
if (item) {
struct mailmap_info *mi = (struct mailmap_info *)item->util;
if (mi->name == NULL && mi->email == NULL) {
debug_mm("map_user: -- (no simple mapping)\n");
if (mi->name == NULL && mi->email == NULL)
return 0;
}
if (mi->email) {
*email = mi->email;
*emaillen = strlen(*email);
@ -348,11 +316,7 @@ int map_user(struct string_list *map,
*name = mi->name;
*namelen = strlen(*name);
}
debug_mm("map_user: to '%.*s' <%.*s>\n",
(int)*namelen, debug_str(*name),
(int)*emaillen, debug_str(*email));
return 1;
}
debug_mm("map_user: --\n");
return 0;
}

Просмотреть файл

@ -170,7 +170,8 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
}
static int fetch_refs_from_bundle(struct transport *transport,
int nr_heads, struct ref **to_fetch)
int nr_heads UNUSED,
struct ref **to_fetch UNUSED)
{
struct bundle_transport_data *data = transport->data;
struct strvec extra_index_pack_args = STRVEC_INIT;